ci: Reduce test duration with parallel subtests
package lifecycletest
import (
+ "fmt"
"testing"
"github.com/blang/semver"
@@ -23,15 +24,24 @@ func TestDestroyTarget(t *testing.T) {
// Try refreshing a stack with combinations of the above resources as target to destroy.
subsets := combinations.All(complexTestDependencyGraphNames)
+ //nolint:paralleltest // false positive because range var isn't used directly in t.Run(name) arg
for _, subset := range subsets {
+ subset := subset
// limit to up to 3 resources to destroy. This keeps the test running time under
// control as it only generates a few hundred combinations instead of several thousand.
if len(subset) <= 3 {
+ t.Run(fmt.Sprintf("%v", subset), func(t *testing.T) {
+ t.Parallel()
+
destroySpecificTargets(t, subset, true, /*targetDependents*/
func(urns []resource.URN, deleted map[resource.URN]bool) {})
+ })
}
}
+ t.Run("destroy root", func(t *testing.T) {
+ t.Parallel()
+
destroySpecificTargets(
t, []string{"A"}, true, /*targetDependents*/
func(urns []resource.URN, deleted map[resource.URN]bool) {
@@ -52,6 +62,7 @@ func TestDestroyTarget(t *testing.T) {
pickURN(t, urns, names, "L"): true,
}, deleted)
})
+ })
destroySpecificTargets(
t, []string{"A"}, false, /*targetDependents*/
@@ -145,11 +156,17 @@ func TestUpdateTarget(t *testing.T) {
// Try refreshing a stack with combinations of the above resources as target to destroy.
subsets := combinations.All(complexTestDependencyGraphNames)
+ //nolint:paralleltest // false positive because range var isn't used directly in t.Run(name) arg
for _, subset := range subsets {
+ subset := subset
// limit to up to 3 resources to destroy. This keeps the test running time under
// control as it only generates a few hundred combinations instead of several thousand.
if len(subset) <= 3 {
+ t.Run(fmt.Sprintf("update %v", subset), func(t *testing.T) {
+ t.Parallel()
+
updateSpecificTargets(t, subset, false /*targetDependents*/)
+ })
}
}
