Skip to content

Commit a65383b

Browse files
authored
tests: Fix issues from recent staging signingconfig change (#1484)
1 parent 85ba655 commit a65383b

File tree

1 file changed

+9
-11
lines changed

1 file changed

+9
-11
lines changed

test/unit/test_sign.py

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,12 @@
2929
from sigstore.verify.policy import UnsafeNoOp
3030

3131

32-
@pytest.mark.parametrize("env", ["staging", "production"])
32+
# only check the log contents for production: staging is already on
33+
# rekor v2 and we don't currently support log lookups on rekor v2.
34+
# This test can likely be removed once prod also uses rekor v2
35+
@pytest.mark.parametrize("env", ["production"])
3336
@pytest.mark.ambient_oidc
34-
def test_sign_rekor_entry_consistent(sign_ctx_and_ident_for_env):
37+
def test_sign_rekor_entry_consistent(request, sign_ctx_and_ident_for_env):
3538
ctx_cls, identity = sign_ctx_and_ident_for_env
3639

3740
# NOTE: The actual signer instance is produced lazily, so that parameter
@@ -108,25 +111,20 @@ def test_sct_verify_keyring_error(sign_ctx_and_ident_for_env, monkeypatch):
108111

109112
@pytest.mark.parametrize("env", ["staging", "production"])
110113
@pytest.mark.ambient_oidc
111-
def test_identity_proof_claim_lookup(sign_ctx_and_ident_for_env, monkeypatch):
114+
def test_identity_proof_fallback_claim(sign_ctx_and_ident_for_env, monkeypatch):
112115
ctx_cls, identity = sign_ctx_and_ident_for_env
113116

114117
ctx: SigningContext = ctx_cls()
115118
assert identity is not None
116119

117-
# clear out the known issuers, forcing the `Identity`'s `proof_claim` to be looked up.
120+
# clear out known issuers, forcing the `Identity`'s `sub` claim to be used
121+
# as fall back
118122
monkeypatch.setattr(sigstore.oidc, "_KNOWN_OIDC_ISSUERS", {})
119123

120124
payload = secrets.token_bytes(32)
121125

122126
with ctx.signer(identity) as signer:
123-
expected_entry = signer.sign_artifact(payload).log_entry
124-
actual_entry = ctx._rekor.log.entries.get(log_index=expected_entry.log_index)
125-
126-
assert expected_entry.body == actual_entry.body
127-
assert expected_entry.integrated_time == actual_entry.integrated_time
128-
assert expected_entry.log_id == actual_entry.log_id
129-
assert expected_entry.log_index == actual_entry.log_index
127+
signer.sign_artifact(payload)
130128

131129

132130
@pytest.mark.staging

0 commit comments

Comments
 (0)