Skip to content

Commit d6f485f

Browse files
Merge pull request #168 from wongni/fix-invalid-resource-e2e-tests
Remove checking name when looking for a certain error message because…
2 parents d96124b + da9a2df commit d6f485f

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

test/e2e/invalid_resource.go

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -212,7 +212,9 @@ func generateClusterName() string {
212212

213213
// errorExistsInLog looks for a specific error message in the CAPC controller log files. Because the logs may contain
214214
// entries from previous test runs, or from previous tests in the same run, the function also requires that the log
215-
// line contains the namespace and cluster names.
215+
// line contains the namespace. The cluster name is not check because some controllers such as failure domain controller
216+
// prints a different name which is not the cluster name. In the e2e testing, the namespace only is unique enough because
217+
// it is generated randomly per test case.
216218
func errorExistsInLog(logFolder string, expectedError string) (bool, error) {
217219
expectedErrorFound := errors.New("expected error found")
218220
controllerLogPath := filepath.Join(logFolder, "controllers", "capc-controller-manager")
@@ -227,8 +229,7 @@ func errorExistsInLog(logFolder string, expectedError string) (bool, error) {
227229
logLines := strings.Split(string(log), "\n")
228230
for _, line := range logLines {
229231
if strings.Contains(line, expectedError) &&
230-
strings.Contains(line, clusterResources.Cluster.Namespace) &&
231-
strings.Contains(line, clusterResources.Cluster.Name) {
232+
strings.Contains(line, clusterResources.Cluster.Namespace) {
232233
Byf("Found %q error", expectedError)
233234
return expectedErrorFound
234235
}

0 commit comments

Comments
 (0)