Skip to content

Commit

Permalink
chore: fix slices and maps merge test (#10063)
Browse files Browse the repository at this point in the history
  • Loading branch information
amandavialva01 authored Oct 15, 2024
1 parent 219409b commit 1d5c984
Showing 1 changed file with 36 additions and 2 deletions.
38 changes: 36 additions & 2 deletions master/internal/configpolicy/task_config_policy_intg_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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{
Expand Down Expand Up @@ -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())
})
}

Expand Down

0 comments on commit 1d5c984

Please sign in to comment.