Skip to content

Commit 81d697b

Browse files
committed
tests: fixup attestation tar to not panic when file not found
Signed-off-by: Justin Chadwell <[email protected]>
1 parent 016938b commit 81d697b

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

client/client_test.go

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7692,8 +7692,9 @@ func testExportAttestations(t *testing.T, sb integration.Sandbox) {
76927692

76937693
for _, p := range ps {
76947694
var attest intoto.Statement
7695-
dt := m[path.Join(strings.ReplaceAll(platforms.Format(p), "/", "_"), "test.attestation.json")].Data
7696-
require.NoError(t, json.Unmarshal(dt, &attest))
7695+
item := m[path.Join(strings.ReplaceAll(platforms.Format(p), "/", "_"), "test.attestation.json")]
7696+
require.NotNil(t, item)
7697+
require.NoError(t, json.Unmarshal(item.Data, &attest))
76977698

76987699
require.Equal(t, "https://in-toto.io/Statement/v0.1", attest.Type)
76997700
require.Equal(t, "https://example.com/attestations/v1.0", attest.PredicateType)
@@ -7705,8 +7706,9 @@ func testExportAttestations(t *testing.T, sb integration.Sandbox) {
77057706
}}, attest.Subject)
77067707

77077708
var attest2 intoto.Statement
7708-
dt = m[path.Join(strings.ReplaceAll(platforms.Format(p), "/", "_"), "test.attestation2.json")].Data
7709-
require.NoError(t, json.Unmarshal(dt, &attest2))
7709+
item = m[path.Join(strings.ReplaceAll(platforms.Format(p), "/", "_"), "test.attestation2.json")]
7710+
require.NotNil(t, item)
7711+
require.NoError(t, json.Unmarshal(item.Data, &attest2))
77107712

77117713
require.Equal(t, "https://in-toto.io/Statement/v0.1", attest2.Type)
77127714
require.Equal(t, "https://example.com/attestations2/v1.0", attest2.PredicateType)

0 commit comments

Comments
 (0)