Skip to content

Commit

Permalink
Make failing tests handle the changes to the logging configuration
Browse files Browse the repository at this point in the history
Signed-off-by: Kim Christensen <kimworking@gmail.com>
  • Loading branch information
kichristensen committed May 7, 2024
1 parent c2001be commit 75c7a7c
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 7 deletions.
2 changes: 1 addition & 1 deletion pkg/build/dockerfile-generator_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ func TestPorter_generateDockerfile(t *testing.T) {
require.NoError(t, err)

// Verify that we logged the dockerfile contents
tests.RequireOutputContains(t, c.TestContext.GetError(), string(gotDockerfile), "expected the dockerfile to be printed to the logs")
tests.RequireOutputContains(t, c.TestContext.GetOutput(), string(gotDockerfile), "expected the dockerfile to be printed to the logs")
test.CompareGoldenFile(t, "testdata/buildkit.Dockerfile", string(gotDockerfile))

// Verify that we didn't generate a Dockerfile at the root of the bundle dir
Expand Down
4 changes: 2 additions & 2 deletions pkg/manifest/manifest_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -310,7 +310,7 @@ func TestManifest_Validate_SchemaVersion(t *testing.T) {

// Check that a warning is printed
// We aren't returning an error because we want to give it a chance to work first. Later we may turn this into a hard error after people have had time to migrate.
assert.Contains(t, cfg.TestContext.GetError(), invalidVersionErr)
assert.Contains(t, cfg.TestContext.GetOutput(), invalidVersionErr)
})
}

Expand Down Expand Up @@ -549,7 +549,7 @@ func TestSetDefaults(t *testing.T) {
err := m.validateMetadata(ctx, cfg.Config)
require.NoError(t, err)
require.Contains(t,
cfg.TestContext.GetError(),
cfg.TestContext.GetOutput(),
"WARNING: both registry and reference were provided; using the reference value of getporter/org/mybun:v1.2.3 for the bundle reference\n",
)

Expand Down
4 changes: 2 additions & 2 deletions tests/smoke/desiredstate_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,8 @@ func TestDesiredState(t *testing.T) {
// This also tests out that --allow-docker-host-access is being defaulted properly from the Porter config file
output, stderr, err := test.RunPorter("installation", "apply", "mybuns.yaml", "--namespace", "operator")
require.NoError(t, err)
require.Contains(t, stderr, "The installation is out-of-sync, running the install action")
require.Contains(t, stderr, "Triggering because the installation has not completed successfully yet")
require.Contains(t, output, "The installation is out-of-sync, running the install action")
require.Contains(t, output, "Triggering because the installation has not completed successfully yet")
installation := test.RequireInstallationExists("operator", "mybuns")
require.Equal(t, "succeeded", installation.Status.ResultStatus)

Expand Down
2 changes: 1 addition & 1 deletion tests/smoke/hello_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ func TestHelloBundle(t *testing.T) {
// This also does a quick regression test to validate that we can change the verbosity to a different value than what is in the config file and have it respected
_, output := test.RequirePorter("plugins", "install", "-f", "plugins.yaml", "--verbosity=info")
require.Contains(t, output, "installed azure plugin", "expected to see plugin successfully installed")
require.NotContainsf(t, output, "Downloading https://cdn.porter.sh/plugins/atom.xml", "Debug information should not have been printed because verbosity is set to info")
require.Containsf(t, output, "Downloading https://cdn.porter.sh/plugins/atom.xml", "Debug information should be printed because verbosity is set to info")

// Run a stateless action before we install and make sure nothing is persisted
_, output = test.RequirePorter("invoke", testdata.MyBuns, "--action=dry-run", "--reference", testdata.MyBunsRef, "-c=mybuns")
Expand Down
3 changes: 2 additions & 1 deletion tests/tester/helpers.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ func (t Tester) MakeTestBundle(name string, ref string) {
}

func (t Tester) ShowInstallation(namespace string, name string) (porter.DisplayInstallation, error) {
stdout, _, err := t.RunPorter("show", name, "--namespace", namespace, "--output=json")
stdout, _, err := t.RunPorter("show", name, "--namespace", namespace, "--output=json", "--verbosity=info")
if err != nil {
return porter.DisplayInstallation{}, err
}
Expand Down Expand Up @@ -91,6 +91,7 @@ func (t Tester) ListInstallations(allNamespaces bool, namespace string, name str
"list",
"--output=json",
"--name", name,
"--verbosity=info",
}
if allNamespaces {
args = append(args, "--all-namespaces")
Expand Down

0 comments on commit 75c7a7c

Please sign in to comment.