From a019466315c21a47d1d6d5e31b01c4fb90c0c292 Mon Sep 17 00:00:00 2001 From: Nathan Rijksen Date: Mon, 16 Oct 2023 11:49:10 -0700 Subject: [PATCH] Fix tests --- internal/runbits/requirements/rationalize.go | 2 +- test/integration/activate_int_test.go | 2 +- test/integration/checkout_int_test.go | 4 ++-- test/integration/install_int_test.go | 14 +++++++------- test/integration/push_int_test.go | 16 ++++++++-------- 5 files changed, 19 insertions(+), 19 deletions(-) diff --git a/internal/runbits/requirements/rationalize.go b/internal/runbits/requirements/rationalize.go index fa2f8cf21d..adade766d9 100644 --- a/internal/runbits/requirements/rationalize.go +++ b/internal/runbits/requirements/rationalize.go @@ -41,7 +41,7 @@ func (r *RequirementOperation) rationalizeError(err *error) { // No matches, but have alternate suggestions case errors.As(*err, &noMatchesErr) && noMatchesErr.Alternatives != nil: *err = errs.WrapUserFacing(*err, - locale.Tr("package_ingredient_alternatives", tooManyMatchesErr.Query, *noMatchesErr.Alternatives), + locale.Tr("package_ingredient_alternatives", noMatchesErr.Query, *noMatchesErr.Alternatives), errs.SetInput()) // We communicate buildplanner errors verbatim as the intend is that these are curated by the buildplanner diff --git a/test/integration/activate_int_test.go b/test/integration/activate_int_test.go index 3e9bdf6ac8..6932fe6b11 100644 --- a/test/integration/activate_int_test.go +++ b/test/integration/activate_int_test.go @@ -198,7 +198,7 @@ func (suite *ActivateIntegrationTestSuite) TestActivatePythonByHostOnly() { cp.ExpectNotExitCode(0) if strings.Count(cp.Snapshot(), " x ") != 1 { - suite.Fail("Expected exactly ONE error message, got: %s", cp.Snapshot()) + suite.Fail("Expected exactly ONE error message, got: ", cp.Snapshot()) } } } diff --git a/test/integration/checkout_int_test.go b/test/integration/checkout_int_test.go index 0495b01342..6b239d5031 100644 --- a/test/integration/checkout_int_test.go +++ b/test/integration/checkout_int_test.go @@ -97,7 +97,7 @@ func (suite *CheckoutIntegrationTestSuite) TestCheckoutNonEmptyDir() { cp.ExpectExitCode(1) if strings.Count(cp.Snapshot(), " x ") != 1 { - suite.Fail("Expected exactly ONE error message, got: %s", cp.Snapshot()) + suite.Fail("Expected exactly ONE error message, got: ", cp.Snapshot()) } // remove file @@ -217,7 +217,7 @@ func (suite *CheckoutIntegrationTestSuite) TestCheckoutNotFound() { cp.ExpectExitCode(1) if strings.Count(cp.Snapshot(), " x ") != 1 { - suite.Fail("Expected exactly ONE error message, got: %s", cp.Snapshot()) + suite.Fail("Expected exactly ONE error message, got: ", cp.Snapshot()) } } diff --git a/test/integration/install_int_test.go b/test/integration/install_int_test.go index c7017f0e89..0851c5bfd4 100644 --- a/test/integration/install_int_test.go +++ b/test/integration/install_int_test.go @@ -36,7 +36,7 @@ func (suite *InstallIntegrationTestSuite) TestInstall_InvalidCommit() { cp.ExpectExitCode(1) if strings.Count(cp.Snapshot(), " x ") != 1 { - suite.Fail("Expected exactly ONE error message, got: %s", cp.Snapshot()) + suite.Fail("Expected exactly ONE error message, got: ", cp.Snapshot()) } } @@ -51,8 +51,8 @@ func (suite *InstallIntegrationTestSuite) TestInstall_NoMatches_NoAlternatives() cp.Expect("find alternatives") // This verifies no alternatives were found cp.ExpectExitCode(1) - if strings.Count(cp.Snapshot(), " x ") != 1 { - suite.Fail("Expected exactly ONE error message, got: %s", cp.Snapshot()) + if strings.Count(strings.ReplaceAll(cp.Snapshot(), " x Failed", ""), " x ") != 1 { + suite.Fail("Expected exactly ONE error message, got: ", cp.Snapshot()) } } @@ -67,8 +67,8 @@ func (suite *InstallIntegrationTestSuite) TestInstall_NoMatches_Alternatives() { cp.Expect("did you mean") // This verifies alternatives were found cp.ExpectExitCode(1) - if strings.Count(cp.Snapshot(), " x ") != 1 { - suite.Fail("Expected exactly ONE error message, got: %s", cp.Snapshot()) + if strings.Count(strings.ReplaceAll(cp.Snapshot(), " x Failed", ""), " x ") != 1 { + suite.Fail("Expected exactly ONE error message, got: ", cp.Snapshot()) } } @@ -82,8 +82,8 @@ func (suite *InstallIntegrationTestSuite) TestInstall_BuildPlannerError() { cp.Expect("Could not plan build, platform responded with", e2e.RuntimeSourcingTimeoutOpt) cp.ExpectExitCode(1) - if strings.Count(cp.Snapshot(), " x ") != 1 { - suite.Fail("Expected exactly ONE error message, got: %s", cp.Snapshot()) + if strings.Count(strings.ReplaceAll(cp.Snapshot(), " x Failed", ""), " x ") != 1 { + suite.Fail("Expected exactly ONE error message, got: ", cp.Snapshot()) } } diff --git a/test/integration/push_int_test.go b/test/integration/push_int_test.go index dc24ce4093..60937938aa 100644 --- a/test/integration/push_int_test.go +++ b/test/integration/push_int_test.go @@ -276,7 +276,7 @@ func (suite *PushIntegrationTestSuite) TestPush_NoProject() { cp.ExpectExitCode(1) if strings.Count(cp.Snapshot(), " x ") != 1 { - suite.Fail("Expected exactly ONE error message, got: %s", cp.Snapshot()) + suite.Fail("Expected exactly ONE error message, got: ", cp.Snapshot()) } } @@ -293,7 +293,7 @@ func (suite *PushIntegrationTestSuite) TestPush_NoAuth() { cp.ExpectExitCode(1) if strings.Count(cp.Snapshot(), " x ") != 1 { - suite.Fail("Expected exactly ONE error message, got: %s", cp.Snapshot()) + suite.Fail("Expected exactly ONE error message, got: ", cp.Snapshot()) } } @@ -312,7 +312,7 @@ func (suite *PushIntegrationTestSuite) TestPush_NoChanges() { cp.ExpectExitCode(1) if strings.Count(cp.Snapshot(), " x ") != 1 { - suite.Fail("Expected exactly ONE error message, got: %s", cp.Snapshot()) + suite.Fail("Expected exactly ONE error message, got: ", cp.Snapshot()) } } @@ -330,7 +330,7 @@ func (suite *PushIntegrationTestSuite) TestPush_NoCommit() { cp.ExpectExitCode(1) if strings.Count(cp.Snapshot(), " x ") != 1 { - suite.Fail("Expected exactly ONE error message, got: %s", cp.Snapshot()) + suite.Fail("Expected exactly ONE error message, got: ", cp.Snapshot()) } } @@ -350,7 +350,7 @@ func (suite *PushIntegrationTestSuite) TestPush_NameInUse() { cp.ExpectExitCode(1) if strings.Count(cp.Snapshot(), " x ") != 1 { - suite.Fail("Expected exactly ONE error message, got: %s", cp.Snapshot()) + suite.Fail("Expected exactly ONE error message, got: ", cp.Snapshot()) } } @@ -375,7 +375,7 @@ func (suite *PushIntegrationTestSuite) TestPush_Aborted() { cp.ExpectExitCode(1) if strings.Count(cp.Snapshot(), " x ") != 1 { - suite.Fail("Expected exactly ONE error message, got: %s", cp.Snapshot()) + suite.Fail("Expected exactly ONE error message, got: ", cp.Snapshot()) } } @@ -395,7 +395,7 @@ func (suite *PushIntegrationTestSuite) TestPush_InvalidHistory() { cp.ExpectExitCode(1) if strings.Count(cp.Snapshot(), " x ") != 1 { - suite.Fail("Expected exactly ONE error message, got: %s", cp.Snapshot()) + suite.Fail("Expected exactly ONE error message, got: ", cp.Snapshot()) } } @@ -414,7 +414,7 @@ func (suite *PushIntegrationTestSuite) TestPush_PullNeeded() { cp.ExpectExitCode(1) if strings.Count(cp.Snapshot(), " x ") != 1 { - suite.Fail("Expected exactly ONE error message, got: %s", cp.Snapshot()) + suite.Fail("Expected exactly ONE error message, got: ", cp.Snapshot()) } }