Skip to content

Commit

Permalink
test: fix cue used in verify-attstation
Browse files Browse the repository at this point in the history
  • Loading branch information
otms61 committed Aug 16, 2022
1 parent ed9e3b1 commit 97ca4aa
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions test/e2e_test.go
Expand Up @@ -212,8 +212,8 @@ func TestAttestVerify(t *testing.T) {
attestVerify(t,
"slsaprovenance",
`{ "buildType": "x", "builder": { "id": "2" }, "recipe": {} }`,
`builder: id: "1"`,
`builder: id: "2"`,
`predicate: builder: id: "2"`,
`predicate: builder: id: "1"`,
)
}

Expand All @@ -225,8 +225,8 @@ func TestAttestVerifySPDXJSON(t *testing.T) {
attestVerify(t,
"spdxjson",
string(attestationBytes),
`Data: spdxVersion: "SPDX-9.9"`,
`Data: spdxVersion: "SPDX-2.2"`,
`predicate: Data: spdxVersion: "SPDX-2.2"`,
`predicate: Data: spdxVersion: "SPDX-9.9"`,
)
}

Expand All @@ -238,8 +238,8 @@ func TestAttestVerifyCycloneDXJSON(t *testing.T) {
attestVerify(t,
"cyclonedx",
string(attestationBytes),
`Data: specVersion: "7.7"`,
`Data: specVersion: "1.4"`,
`predicate: Data: specVersion: "1.4"`,
`predicate: Data: specVersion: "7.7"`,
)
}

Expand Down Expand Up @@ -304,6 +304,7 @@ func attestVerify(t *testing.T, predicateType, attestation, goodCue, badCue stri
if err := os.WriteFile(policyPath, []byte(badCue), 0600); err != nil {
t.Fatal(err)
}
mustErr(verifyAttestation.Exec(ctx, []string{imgName}), t)

// Success case
if err := os.WriteFile(policyPath, []byte(goodCue), 0600); err != nil {
Expand Down Expand Up @@ -1039,7 +1040,7 @@ func TestSaveLoadAttestation(t *testing.T) {
verifyAttestation.PredicateType = "slsaprovenance"
verifyAttestation.Policies = []string{policyPath}
// Success case (remote)
cuePolicy := `builder: id: "2"`
cuePolicy := `predicate: builder: id: "2"`
if err := os.WriteFile(policyPath, []byte(cuePolicy), 0600); err != nil {
t.Fatal(err)
}
Expand Down

0 comments on commit 97ca4aa

Please sign in to comment.