Skip to content

Commit

Permalink
remove redundant kargs assertions
Browse files Browse the repository at this point in the history
The Config Drift Monitor has no interaction with kernel args. This
particular case is better covered by the TestKernelArguments test.
  • Loading branch information
cheesesashimi authored and jmarrero committed Jul 12, 2022
1 parent 5bd4d4e commit 01af7ed
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 27 deletions.
17 changes: 0 additions & 17 deletions test/e2e-shared-tests/helpers.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ import (
"github.com/openshift/machine-config-operator/pkg/daemon/constants"
"github.com/openshift/machine-config-operator/test/framework"
"github.com/openshift/machine-config-operator/test/helpers"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
kubeErrs "k8s.io/apimachinery/pkg/util/errors"
"k8s.io/apimachinery/pkg/util/wait"
Expand All @@ -21,22 +20,6 @@ import (
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
)

func assertKernelArgsEqual(t *testing.T, cs *framework.ClientSet, target corev1.Node, startKargs string, expectedKargs []string) {
t.Helper()

kargs := getKernelArgs(t, cs, target)

for _, karg := range expectedKargs {
assert.Contains(t, kargs, karg, "Missing karg %s", karg)
}

assert.Equal(t, kargs, startKargs)
}

func getKernelArgs(t *testing.T, cs *framework.ClientSet, target corev1.Node) string {
return helpers.ExecCmdOnNode(t, cs, target, "cat", "/proc/cmdline")
}

func waitForConfigDriftMonitorStart(t *testing.T, cs *framework.ClientSet, node corev1.Node) {
t.Helper()

Expand Down
11 changes: 1 addition & 10 deletions test/e2e-shared-tests/mcd_config_drift.go
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ func (c configDriftTest) getMachineConfig(t *testing.T) *mcfgv1.MachineConfig {
[]ign3types.SSHAuthorizedKey{},
[]string{},
false,
[]string{"foo=bar", "foo=baz"},
[]string{},
"",
"",
)
Expand All @@ -164,12 +164,6 @@ func (c configDriftTest) Teardown(t *testing.T) {

// Runs the Config Drift Test
func (c configDriftTest) Run(t *testing.T) {
// Get our kernel args for future verification
kargs := getKernelArgs(t, c.ClientSet, c.node)

// Check that we have our kernel args pre-test
assertKernelArgsEqual(t, c.ClientSet, c.node, kargs, c.mc.Spec.KernelArguments)

testCases := []struct {
name string
rebootExpected bool
Expand Down Expand Up @@ -238,9 +232,6 @@ func (c configDriftTest) Run(t *testing.T) {

testCase.testFunc(t)

// Ensure that we have our kernel args post-test
assertKernelArgsEqual(t, c.ClientSet, c.node, kargs, c.mc.Spec.KernelArguments)

// Verify our reboot expectations
if testCase.rebootExpected {
helpers.AssertNodeReboot(t, c.ClientSet, c.node, initialUptime)
Expand Down

0 comments on commit 01af7ed

Please sign in to comment.