checker: migrate Evaluate to per-subject []CheckState
Each distinct TLS issuer now produces its own CheckState with Subject set to the issuer label, instead of being folded into a single concatenated status. Aligns with the SDK v2 contract (see checker-sdk-go/migrate-v2.md).
This commit is contained in:
parent
b9175054bc
commit
14ab12a4b0
3 changed files with 67 additions and 86 deletions
|
|
@ -69,7 +69,11 @@ func TestRule_OK(t *testing.T) {
|
|||
}),
|
||||
},
|
||||
}
|
||||
state := Rule().Evaluate(context.Background(), obs, nil)
|
||||
states := Rule().Evaluate(context.Background(), obs, nil)
|
||||
if len(states) != 1 {
|
||||
t.Fatalf("expected 1 state, got %d", len(states))
|
||||
}
|
||||
state := states[0]
|
||||
if state.Status != sdk.StatusOK {
|
||||
t.Fatalf("expected StatusOK, got %s: %s", state.Status, state.Message)
|
||||
}
|
||||
|
|
@ -96,7 +100,11 @@ func TestRule_NotAuthorized(t *testing.T) {
|
|||
}),
|
||||
},
|
||||
}
|
||||
state := Rule().Evaluate(context.Background(), obs, nil)
|
||||
states := Rule().Evaluate(context.Background(), obs, nil)
|
||||
if len(states) != 1 {
|
||||
t.Fatalf("expected 1 state, got %d", len(states))
|
||||
}
|
||||
state := states[0]
|
||||
if state.Status != sdk.StatusCrit {
|
||||
t.Fatalf("expected StatusCrit, got %s: %s", state.Status, state.Message)
|
||||
}
|
||||
|
|
@ -126,7 +134,11 @@ func TestRule_IssuanceDisallowed(t *testing.T) {
|
|||
}),
|
||||
},
|
||||
}
|
||||
state := Rule().Evaluate(context.Background(), obs, nil)
|
||||
states := Rule().Evaluate(context.Background(), obs, nil)
|
||||
if len(states) != 1 {
|
||||
t.Fatalf("expected 1 state, got %d", len(states))
|
||||
}
|
||||
state := states[0]
|
||||
if state.Status != sdk.StatusCrit {
|
||||
t.Fatalf("expected StatusCrit, got %s: %s", state.Status, state.Message)
|
||||
}
|
||||
|
|
@ -153,7 +165,11 @@ func TestRule_IssuerUnknown(t *testing.T) {
|
|||
}),
|
||||
},
|
||||
}
|
||||
state := Rule().Evaluate(context.Background(), obs, nil)
|
||||
states := Rule().Evaluate(context.Background(), obs, nil)
|
||||
if len(states) != 1 {
|
||||
t.Fatalf("expected 1 state, got %d", len(states))
|
||||
}
|
||||
state := states[0]
|
||||
if state.Status != sdk.StatusInfo {
|
||||
t.Fatalf("expected StatusInfo, got %s: %s", state.Status, state.Message)
|
||||
}
|
||||
|
|
@ -172,7 +188,11 @@ func TestRule_NoTLS(t *testing.T) {
|
|||
},
|
||||
related: nil,
|
||||
}
|
||||
state := Rule().Evaluate(context.Background(), obs, nil)
|
||||
states := Rule().Evaluate(context.Background(), obs, nil)
|
||||
if len(states) != 1 {
|
||||
t.Fatalf("expected 1 state, got %d", len(states))
|
||||
}
|
||||
state := states[0]
|
||||
if state.Status != sdk.StatusUnknown {
|
||||
t.Fatalf("expected StatusUnknown, got %s: %s", state.Status, state.Message)
|
||||
}
|
||||
|
|
@ -197,7 +217,11 @@ func TestRule_NoCAAPublished(t *testing.T) {
|
|||
}),
|
||||
},
|
||||
}
|
||||
state := Rule().Evaluate(context.Background(), obs, nil)
|
||||
states := Rule().Evaluate(context.Background(), obs, nil)
|
||||
if len(states) != 1 {
|
||||
t.Fatalf("expected 1 state, got %d", len(states))
|
||||
}
|
||||
state := states[0]
|
||||
if state.Status != sdk.StatusInfo {
|
||||
t.Fatalf("expected StatusInfo (no policy), got %s: %s", state.Status, state.Message)
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue