Skip to content

Commit 070c4ed

Browse files
anonymous function for optional daemonsets
1 parent b232e4a commit 070c4ed

File tree

1 file changed

+13
-7
lines changed

1 file changed

+13
-7
lines changed

test/cases/nvidia-training/main_test.go

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -91,16 +91,22 @@ func TestMain(m *testing.M) {
9191
// Wait for required DaemonSets
9292
common.DeployDaemonSet("nvidia-device-plugin-daemonset", "kube-system"),
9393
common.DeployDaemonSet("aws-efa-k8s-device-plugin-daemonset", "kube-system"),
94+
95+
func(ctx context.Context, config *envconf.Config) (context.Context, error) {
96+
if len(testConfig.MetricDimensions) > 0 {
97+
if ctx, err := common.DeployDaemonSet("dcgm-exporter", "kube-system")(ctx, config); err != nil {
98+
return ctx, err
99+
}
100+
if ctx, err := common.DeployDaemonSet("cwagent", "amazon-cloudwatch")(ctx, config); err != nil {
101+
return ctx, err
102+
}
103+
}
104+
return ctx, nil
105+
}, // Deploy CloudWatch Agent + DCGM only if MetricDimensions are set
106+
94107
checkNodeTypes, // Dynamically check node types and capacities after device plugins are ready
95108
)
96109

97-
if len(testConfig.MetricDimensions) > 0 {
98-
testenv.Setup(
99-
common.DeployDaemonSet("dcgm-exporter", "kube-system"),
100-
common.DeployDaemonSet("cwagent", "amazon-cloudwatch"),
101-
)
102-
}
103-
104110
testenv.Finish(
105111
func(ctx context.Context, config *envconf.Config) (context.Context, error) {
106112
log.Println("Deleting NVIDIA device plugin, MPI operator, EFA device plugin DCGM Exporter and CloudWatch Agent manifests.")

0 commit comments

Comments
 (0)