Skip to content

Commit 9e19b2b

Browse files
Merge pull request #395 from GoogleCloudPlatform/issue394
fix: for #394
2 parents 86cffca + 6e2b981 commit 9e19b2b

File tree

2 files changed

+31
-10
lines changed

2 files changed

+31
-10
lines changed

internal/cmd/integrations/apply.go

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -193,6 +193,8 @@ func init() {
193193
false, "Skip applying connector configuration; default is false")
194194
ApplyCmd.Flags().BoolVarP(&skipAuthconfigs, "skip-authconfigs", "",
195195
false, "Skip applying authconfigs configuration; default is false")
196+
ApplyCmd.Flags().BoolVarP(&skipTestCases, "skip-testcases", "",
197+
false, "Skip applying testcases; default is false")
196198
ApplyCmd.Flags().BoolVarP(&useUnderscore, "use-underscore", "",
197199
false, "Use underscore as a file splitter; default is __")
198200
ApplyCmd.Flags().BoolVarP(&runTests, "run-tests", "",
@@ -607,8 +609,12 @@ func processIntegration(overridesFile string, integrationFolder string, testsFol
607609
}
608610

609611
// create test cases for integration
610-
if err = processTestCases(testsFolder, getFilenameWithoutExtension(integrationNames[0]), version); err != nil {
611-
return err
612+
if !skipTestCases {
613+
if err = processTestCases(testsFolder, getFilenameWithoutExtension(integrationNames[0]), version); err != nil {
614+
return err
615+
}
616+
} else {
617+
clilog.Info.Printf("Skipping applying testcases configuration\n")
612618
}
613619

614620
// publish the integration

internal/cmd/integrations/scaffold.go

Lines changed: 23 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -113,8 +113,12 @@ var ScaffoldCmd = &cobra.Command{
113113
if overridesBody, err = integrations.Get(name, version, false, false, true); err != nil {
114114
return err
115115
}
116-
if testCasesBody, err = integrations.ListTestCases(name, version, false, "", -1, "", ""); err != nil {
117-
return err
116+
if !skipTestCases {
117+
if testCasesBody, err = integrations.ListTestCases(name, version, false, "", -1, "", ""); err != nil {
118+
return err
119+
}
120+
} else {
121+
clilog.Info.Printf("Skipping scaffolding testcases\n")
118122
}
119123
} else if userLabel != "" {
120124
if integrationBody, err = integrations.GetByUserlabel(name, userLabel, false, true, false); err != nil {
@@ -123,18 +127,27 @@ var ScaffoldCmd = &cobra.Command{
123127
if overridesBody, err = integrations.GetByUserlabel(name, userLabel, false, false, true); err != nil {
124128
return err
125129
}
126-
if testCasesBody, err = integrations.ListTestCasesByUserlabel(name, userLabel, false, "", -1, "", ""); err != nil {
127-
return err
130+
if !skipTestCases {
131+
if testCasesBody, err = integrations.ListTestCasesByUserlabel(name, userLabel, false, "", -1, "", ""); err != nil {
132+
return err
133+
}
134+
} else {
135+
clilog.Info.Printf("Skipping scaffolding testcases\n")
128136
}
137+
129138
} else if snapshot != "" {
130139
if integrationBody, err = integrations.GetBySnapshot(name, snapshot, false, true, false); err != nil {
131140
return err
132141
}
133142
if overridesBody, err = integrations.GetBySnapshot(name, snapshot, false, false, true); err != nil {
134143
return err
135144
}
136-
if testCasesBody, err = integrations.ListTestCasesBySnapshot(name, snapshot, false, "", -1, "", ""); err != nil {
137-
return err
145+
if !skipTestCases {
146+
if testCasesBody, err = integrations.ListTestCasesBySnapshot(name, snapshot, false, "", -1, "", ""); err != nil {
147+
return err
148+
}
149+
} else {
150+
clilog.Info.Printf("Skipping scaffolding testcases\n")
138151
}
139152
} else {
140153
return errors.New("latest version not found. 1) The integration may be in DRAFT state. Pass a snapshot number. 2) An invalid integration name was set. 3) Latest flag was combined with version, snapshot or user-label")
@@ -426,8 +439,8 @@ Generate scaffold for integration and produce cloud deploy config: ` + GetExampl
426439
}
427440

428441
var (
429-
cloudBuild, cloudDeploy, skipConnectors, skipAuthconfigs, useUnderscore, extractCode bool
430-
env string
442+
cloudBuild, cloudDeploy, skipConnectors, skipAuthconfigs, skipTestCases, useUnderscore, extractCode bool
443+
env string
431444
)
432445

433446
const jsonExt = ".json"
@@ -461,6 +474,8 @@ func init() {
461474
false, "Exclude connectors from scaffold")
462475
ScaffoldCmd.Flags().BoolVarP(&skipAuthconfigs, "skip-authconfigs", "",
463476
false, "Exclude authconfigs from scaffold")
477+
ScaffoldCmd.Flags().BoolVarP(&skipTestCases, "skip-testcases", "",
478+
false, "Exclude testcases from scaffold")
464479
ScaffoldCmd.Flags().BoolVarP(&useUnderscore, "use-underscore", "",
465480
false, "Use underscore as a file splitter; default is __")
466481
ScaffoldCmd.Flags().BoolVarP(&extractCode, "extract-code", "x",

0 commit comments

Comments
 (0)