Skip to content

Commit d1a5492

Browse files
committed
Use same test setup pattern as Docker scan tests
1 parent b22d8cf commit d1a5492

File tree

1 file changed

+6
-24
lines changed

1 file changed

+6
-24
lines changed

curation_test.go

Lines changed: 6 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -113,27 +113,13 @@ func TestDockerCurationAudit(t *testing.T) {
113113
t.Skip("Skipping Docker curation test - container registry not configured")
114114
}
115115

116-
cleanUpJfrogHome, err := coreTests.SetJfrogHome()
117-
assert.NoError(t, err)
118-
defer cleanUpJfrogHome()
119-
120-
serverDetails := &config.ServerDetails{
121-
ServerId: "default",
122-
Url: *securityTests.JfrogUrl,
123-
ArtifactoryUrl: *securityTests.JfrogUrl + securityTests.ArtifactoryEndpoint,
124-
XrayUrl: *securityTests.JfrogUrl + securityTests.XrayEndpoint,
125-
AccessToken: *securityTests.JfrogAccessToken,
126-
}
127-
configCmd := commonCommands.NewConfigCommand(commonCommands.AddOrEdit, serverDetails.ServerId).
128-
SetDetails(serverDetails).
129-
SetInteractive(false)
130-
assert.NoError(t, configCmd.Run())
131-
132-
loginCmd := exec.Command("docker", "login", *securityTests.ContainerRegistry, "-u", "admin", "--password-stdin")
116+
cleanUp := integration.UseTestHomeWithDefaultXrayConfig(t)
117+
defer cleanUp()
118+
integration.CreateJfrogHomeConfig(t, "", securityTests.XrDetails, true)
119+
loginCmd := exec.Command("docker", "login", *securityTests.ContainerRegistry, "-u", *securityTests.JfrogUser, "--password-stdin")
133120
loginCmd.Stdin = strings.NewReader(*securityTests.JfrogAccessToken)
134-
if loginOutput, err := loginCmd.CombinedOutput(); err != nil {
135-
t.Skipf("Skipping Docker curation test - Docker login failed: %s", string(loginOutput))
136-
}
121+
loginOutput, err := loginCmd.CombinedOutput()
122+
require.NoError(t, err, "Docker login failed: %s", string(loginOutput))
137123

138124
testCli := integration.GetXrayTestCli(cli.GetJfrogCliSecurityApp(), false)
139125

@@ -143,10 +129,6 @@ func TestDockerCurationAudit(t *testing.T) {
143129
"--image="+testImage,
144130
"--format="+string(format.Json))
145131

146-
if strings.Contains(output, "docker.sock") || strings.Contains(output, "docker daemon") {
147-
t.Skip("Skipping Docker curation test - Docker is not running")
148-
}
149-
150132
bracketIndex := strings.Index(output, "[")
151133
require.GreaterOrEqual(t, bracketIndex, 0, "Expected JSON array in output, got: %s", output)
152134

0 commit comments

Comments
 (0)