Skip to content

Commit 7a264a0

Browse files
committed
Replace Equal with ErrorContains for image-based nmstatectl unit tests
Signed-off-by: Michail Resvanis <[email protected]>
1 parent 0432677 commit 7a264a0

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

pkg/asset/imagebased/configimage/imagebased_config_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ networkConfig:
9595
state: invalid`,
9696

9797
expectedFound: false,
98-
expectedError: "invalid Image-based Config configuration: networkConfig: Invalid value: interfaces:\n- name: eth0\n state: invalid\n type: ethernet\n: failed to execute 'nmstatectl gc', error: InvalidArgument: Invalid YAML string: interfaces: unknown variant `invalid`, expected one of `up`, `down`, `absent`, `unknown`, `ignore` at line 2 column 1",
98+
expectedError: "networkConfig: Invalid value: interfaces:\n- name: eth0\n state: invalid\n type: ethernet\n: failed to execute 'nmstatectl gc', error: InvalidArgument: Invalid YAML string: interfaces: unknown variant `invalid`",
9999
},
100100
{
101101
name: "invalid-additional-ntp-sources",
@@ -135,7 +135,7 @@ networkConfig:
135135
found, err := asset.Load(fileFetcher)
136136
assert.Equal(t, tc.expectedFound, found)
137137
if tc.expectedError != "" {
138-
assert.Equal(t, tc.expectedError, err.Error())
138+
assert.ErrorContains(t, err, tc.expectedError)
139139
} else {
140140
assert.NoError(t, err)
141141
if tc.expectedConfig != nil {

pkg/asset/imagebased/image/imagebased_config_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -215,7 +215,7 @@ networkConfig:
215215
`,
216216

217217
expectedFound: false,
218-
expectedError: "invalid Image-based Installation ISO Config: networkConfig: Invalid value: invalid: config\n: failed to execute 'nmstatectl gc', error: InvalidArgument: Invalid YAML string: unknown field `invalid`, expected one of `hostname`, `dns-resolver`, `route-rules`, `routes`, `interfaces`, `ovs-db`, `ovn`",
218+
expectedError: "networkConfig: Invalid value: invalid: config\n: failed to execute 'nmstatectl gc', error: InvalidArgument: Invalid YAML string: unknown field `invalid`",
219219
},
220220
{
221221
name: "invalid-imageDigestSources",
@@ -312,7 +312,7 @@ proxy:
312312
found, err := asset.Load(fileFetcher)
313313
assert.Equal(t, tc.expectedFound, found)
314314
if tc.expectedError != "" {
315-
assert.Equal(t, tc.expectedError, err.Error())
315+
assert.ErrorContains(t, err, tc.expectedError)
316316
} else {
317317
assert.NoError(t, err)
318318
if tc.expectedConfig != nil {

0 commit comments

Comments
 (0)