From c9eeda34a3dd422cb76018ebaa20947d5c0ceaae Mon Sep 17 00:00:00 2001 From: CyrusNajmabadi Date: Wed, 6 Feb 2019 19:06:46 -0800 Subject: [PATCH] Don't rerun short tests when running long tests (#220) --- misc/test/examples_test.go | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/misc/test/examples_test.go b/misc/test/examples_test.go index 0403f809d..6a962020d 100644 --- a/misc/test/examples_test.go +++ b/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)