Skip to content

Commit

Permalink
add a bit of extra validation
Browse files Browse the repository at this point in the history
  • Loading branch information
mafredri committed Oct 29, 2024
1 parent d463de4 commit 86db5a5
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions integration/integration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -562,6 +562,9 @@ func TestBuildFromDockerfileAndConfig(t *testing.T) {

validateDockerConfig := func(t *testing.T, tc testCase, ctrID, logs string) {
t.Helper()

// Ensure that the config matches the expected value, base64 is
// always prioritized over a file.
got := execContainer(t, ctrID, "cat /docker_config_json")
got = strings.TrimSpace(got)
want := tc.configBase64
Expand All @@ -572,6 +575,15 @@ func TestBuildFromDockerfileAndConfig(t *testing.T) {
require.Contains(t, logs, "Set DOCKER_CONFIG to /.envbuilder/.docker")
require.Equal(t, want, got)
}

// Ensure that a warning message is printed if config secrets
// will remain in the container after build.
warningMessage := "this file will remain after the build"
if tc.configFile.name != "" {
require.Contains(t, logs, warningMessage)
} else {
require.NotContains(t, logs, warningMessage)
}
}

configJSONContainerPath := workingdir.Default.Join(".docker", "config.json")
Expand Down

0 comments on commit 86db5a5

Please sign in to comment.