Don't rerun short tests when running long tests
MODIFY
misc/test/examples_test.go
misc/test/examples_test.go
@@ -42,7 +42,7 @@ func TestExamples(t *testing.T) {
Overrides: overrides,
}
- examples := []integration.ProgramTestOptions{
+ shortTests := []integration.ProgramTestOptions{
base.With(integration.ProgramTestOptions{
Dir: path.Join(cwd, "..", "..", "aws-js-s3-folder"),
Config: map[string]string{
@@ -230,7 +230,7 @@ func TestExamples(t *testing.T) {
// }),
}
- longExamples := []integration.ProgramTestOptions{
+ longTests := []integration.ProgramTestOptions{
base.With(integration.ProgramTestOptions{
Dir: path.Join(cwd, "..", "..", "azure-ts-aks-helm"),
Config: map[string]string{
@@ -258,15 +258,17 @@ func TestExamples(t *testing.T) {
// }),
}
- // Only include the long examples on non-Short test runs
- if !testing.Short() {
- fmt.Println("Running full test suite including longer tests. To run only shorter tests run with the -short option.")
- examples = append(examples, longExamples...)
+ // Run the short or long tests depending on the config. Note that we only run long tests on
+ // travis after already running short tests. So no need to actually run both at the same time
+ // ever.
+ var tests []integration.ProgramTestOptions
+ if testing.Short() {
+ tests = shortTests
} else {
- fmt.Println("Running short test suite. To run full test suite run without -short option")
+ tests = longTests
}
- for _, ex := range examples {
+ for _, ex := range tests {
example := ex
t.Run(example.Dir, func(t *testing.T) {
integration.ProgramTest(t, &example)

Don't rerun short tests when running long tests (#220)