Skip to content

Commit 6024346

Browse files
authored
Onboard opentelemetry-operations-e2e-testing triggers to Terraform (#111)
Onboard the `opentelemetry-operations-e2e-testing` repository's Cloud Build triggers to Terraform. These triggers were previously created manually in the console. Adding them here so they're tracked as code alongside the other repos.
1 parent 8ca34a1 commit 6024346

5 files changed

Lines changed: 17 additions & 5 deletions

File tree

e2etesting/e2e_testing.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,7 @@ func NoopCleanup() {}
154154

155155
type ApplyPersistentFunc func(ctx context.Context, projectID string, autoApprove bool, logger *log.Logger) error
156156

157-
func InitTestMain(args *Args, applyPersistent ApplyPersistentFunc) (*log.Logger, context.Context) {
157+
func InitTestMain(args *Args, applyPersistent ApplyPersistentFunc) (*log.Logger, context.Context, bool) {
158158
rand.New(rand.NewSource(time.Now().UnixNano()))
159159
p := arg.MustParse(args)
160160
if p.Subcommand() == nil {
@@ -170,7 +170,7 @@ func InitTestMain(args *Args, applyPersistent ApplyPersistentFunc) (*log.Logger,
170170
if err != nil {
171171
logger.Panic(err)
172172
}
173-
return nil, nil
173+
return nil, nil, true
174174
}
175175

176176
// hacky but works
@@ -185,5 +185,5 @@ func InitTestMain(args *Args, applyPersistent ApplyPersistentFunc) (*log.Logger,
185185
}
186186
args.TestRunID = hex
187187
}
188-
return logger, ctx
188+
return logger, ctx, false
189189
}

e2etestrunner/main_test.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,10 @@ var (
3333
)
3434

3535
func TestMain(m *testing.M) {
36-
logger, ctx := e2etesting.InitTestMain(&args, setuptf.ApplyPersistent)
36+
logger, ctx, shouldExit := e2etesting.InitTestMain(&args, setuptf.ApplyPersistent)
37+
if shouldExit {
38+
return
39+
}
3740

3841
var setupFunc e2etesting.SetupFunc
3942
switch {

e2etestrunner_collector/main_test.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,10 @@ var (
2020
)
2121

2222
func TestMain(m *testing.M) {
23-
logger, ctx := e2etesting.InitTestMain(&args, setuptf.ApplyPersistentCollector)
23+
logger, ctx, shouldExit := e2etesting.InitTestMain(&args, setuptf.ApplyPersistentCollector)
24+
if shouldExit {
25+
return
26+
}
2427
resourceFilter = fmt.Sprintf("otelcol_google_e2e:%s", args.TestRunID)
2528
var setupFunc e2etesting.SetupCollectorFunc
2629
switch {

tf/persistent/repo-ci-triggers.tf

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,3 +35,9 @@ module "go" {
3535
repository = "opentelemetry-operations-go"
3636
run_on = ["local", "gce", "gke", "gae", "gae-standard", "cloud-run", "cloud-functions-gen2"]
3737
}
38+
39+
module "e2e_testing" {
40+
source = "../modules/repo-ci-triggers"
41+
repository = "opentelemetry-operations-e2e-testing"
42+
run_on = ["gke", "gce", "gae", "gae-standard", "cloud-run", "cloud-functions-gen2"]
43+
}

0 commit comments

Comments
 (0)