Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Log Generation / Observed generation. #1761

Merged
merged 1 commit into from
Feb 27, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions conformance/utils/kubernetes/helpers.go
Original file line number Diff line number Diff line change
Expand Up @@ -147,13 +147,14 @@ func ConditionsHaveLatestObservedGeneration(obj metav1.Object, conditions []meta
return nil
}

wantGeneration := obj.GetGeneration()
var b strings.Builder
fmt.Fprint(&b, "expected observedGeneration to be updated for all conditions")
fmt.Fprintf(&b, "expected observedGeneration to be updated to %d for all conditions", wantGeneration)
fmt.Fprintf(&b, ", only %d/%d were updated.", len(conditions)-len(staleConditions), len(conditions))
fmt.Fprintf(&b, " stale conditions are: ")

for i, c := range staleConditions {
fmt.Fprintf(&b, c.Type)
fmt.Fprintf(&b, "%s (generation %d)", c.Type, c.ObservedGeneration)
if i != len(staleConditions)-1 {
fmt.Fprintf(&b, ", ")
}
Expand Down
4 changes: 2 additions & 2 deletions conformance/utils/kubernetes/helpers_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ func TestVerifyConditionsMatchGeneration(t *testing.T) {
{Type: "FakeCondition2", ObservedGeneration: 19},
{Type: "FakeCondition3", ObservedGeneration: 20},
},
expected: fmt.Errorf("expected observedGeneration to be updated for all conditions, only 2/3 were updated. stale conditions are: FakeCondition2"),
expected: fmt.Errorf("expected observedGeneration to be updated to 20 for all conditions, only 2/3 were updated. stale conditions are: FakeCondition2 (generation 19)"),
},
{
name: "conditions where most do not match the generation fail verification",
Expand All @@ -121,7 +121,7 @@ func TestVerifyConditionsMatchGeneration(t *testing.T) {
{Type: "FakeCondition5", ObservedGeneration: 16},
{Type: "FakeCondition6", ObservedGeneration: 15},
},
expected: fmt.Errorf("expected observedGeneration to be updated for all conditions, only 1/6 were updated. stale conditions are: FakeCondition1, FakeCondition2, FakeCondition3, FakeCondition5, FakeCondition6"),
expected: fmt.Errorf("expected observedGeneration to be updated to 20 for all conditions, only 1/6 were updated. stale conditions are: FakeCondition1 (generation 18), FakeCondition2 (generation 18), FakeCondition3 (generation 14), FakeCondition5 (generation 16), FakeCondition6 (generation 15)"),
},
}

Expand Down