From 1d5c984b7018907d9ac74999515e4416f26bb16b Mon Sep 17 00:00:00 2001 From: Amanda Vialva <144278621+amandavialva01@users.noreply.github.com> Date: Tue, 15 Oct 2024 18:01:27 -0400 Subject: [PATCH] chore: fix slices and maps merge test (#10063) --- .../task_config_policy_intg_test.go | 38 ++++++++++++++++++- 1 file changed, 36 insertions(+), 2 deletions(-) diff --git a/master/internal/configpolicy/task_config_policy_intg_test.go b/master/internal/configpolicy/task_config_policy_intg_test.go index 3c84a57dc33..ae19901868e 100644 --- a/master/internal/configpolicy/task_config_policy_intg_test.go +++ b/master/internal/configpolicy/task_config_policy_intg_test.go @@ -946,7 +946,24 @@ func testMergeSlicesAndMaps(t *testing.T) { userPartialInvariantConfig) require.NoError(t, err) - require.Equal(t, mergedWkspInvariantConfig, *res) + require.ElementsMatch(t, mergedWkspInvariantConfig.Data(), res.Data()) + require.Equal(t, mergedWkspInvariantConfig.Description(), res.Description()) + require.Equal(t, mergedWkspInvariantConfig.Resources().Slots(), res.Resources().Slots()) + require.ElementsMatch(t, mergedWkspInvariantConfig.Resources().Devices(), + res.Resources().Devices()) + require.Equal(t, mergedWkspInvariantConfig.PreemptionTimeout(), + res.PreemptionTimeout()) + require.ElementsMatch(t, mergedWkspInvariantConfig.BindMounts(), res.BindMounts()) + require.ElementsMatch(t, mergedWkspInvariantConfig.Environment().EnvironmentVariables().CPU(), + res.Environment().EnvironmentVariables().CPU()) + require.ElementsMatch(t, mergedWkspInvariantConfig.Environment().EnvironmentVariables().CUDA(), + res.Environment().EnvironmentVariables().CUDA()) + require.ElementsMatch(t, mergedWkspInvariantConfig.Environment().EnvironmentVariables().ROCM(), + res.Environment().EnvironmentVariables().ROCM()) + require.ElementsMatch(t, mergedWkspInvariantConfig.BindMounts(), res.BindMounts()) + require.ElementsMatch(t, mergedWkspInvariantConfig.Environment().ProxyPorts(), + res.Environment().ProxyPorts()) + require.ElementsMatch(t, mergedWkspInvariantConfig.LogPolicies(), res.LogPolicies()) // Merge user-submitted config with workspace and global config policies. setConfigPolicies(ctx, t, &w.ID, &model.TaskConfigPolicies{ @@ -975,7 +992,24 @@ func testMergeSlicesAndMaps(t *testing.T) { userPartialInvariantConfig) require.NoError(t, err) - require.Equal(t, mergedGlobalInvariantConfig, *res) + require.ElementsMatch(t, mergedGlobalInvariantConfig.Data(), res.Data()) + require.Equal(t, mergedGlobalInvariantConfig.Description(), res.Description()) + require.Equal(t, mergedGlobalInvariantConfig.Resources().Slots(), res.Resources().Slots()) + require.ElementsMatch(t, mergedGlobalInvariantConfig.Resources().Devices(), + res.Resources().Devices()) + require.Equal(t, mergedGlobalInvariantConfig.PreemptionTimeout(), + res.PreemptionTimeout()) + require.ElementsMatch(t, mergedGlobalInvariantConfig.BindMounts(), res.BindMounts()) + require.ElementsMatch(t, mergedGlobalInvariantConfig.Environment().EnvironmentVariables().CPU(), + res.Environment().EnvironmentVariables().CPU()) + require.ElementsMatch(t, mergedGlobalInvariantConfig.Environment().EnvironmentVariables().CUDA(), + res.Environment().EnvironmentVariables().CUDA()) + require.ElementsMatch(t, mergedGlobalInvariantConfig.Environment().EnvironmentVariables().ROCM(), + res.Environment().EnvironmentVariables().ROCM()) + require.ElementsMatch(t, mergedGlobalInvariantConfig.BindMounts(), res.BindMounts()) + require.ElementsMatch(t, mergedGlobalInvariantConfig.Environment().ProxyPorts(), + res.Environment().ProxyPorts()) + require.ElementsMatch(t, mergedGlobalInvariantConfig.LogPolicies(), res.LogPolicies()) }) }