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

tests: direct changes #2676

Merged
merged 2 commits into from
Sep 11, 2024
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: 5 additions & 0 deletions config/tests/servicemapping/servicemapping_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1267,6 +1267,11 @@ func TestStorageVersionIsSetAndValidIFFV1alpha1ToV1beta1IsSet(t *testing.T) {
continue
}
if isV1alpha1ToV1beta1 {
// if this is a direct resource, the storage version is defiend
// in the kubebuilder tooling
if r.Direct {
continue
}
if hasStorageVersion {
t.Errorf("Resource config %v has `v1alpha1ToV1beta1: "+
"true` but doesn't have a valid `storageVersion`: "+
Expand Down
7 changes: 6 additions & 1 deletion pkg/k8s/allowlist_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,11 @@ func TestOutputOnlyFieldsAreUnderObservedState(t *testing.T) {
}
requiredFieldsMap := map[string]bool{"observedGeneration": true, "conditions": true}
optionalFieldsMap := map[string]bool{"observedState": true}

// for direct resources, we will use the "externalRef" prop under the "status"
// to track the KCC full resource ID
optionalFieldsMap["externalRef"] = true

for k, _ := range statusProp.Properties {
foundInMaps := false
if _, ok := requiredFieldsMap[k]; ok {
Expand All @@ -156,7 +161,7 @@ func TestOutputOnlyFieldsAreUnderObservedState(t *testing.T) {
delete(optionalFieldsMap, k)
}
if !foundInMaps {
t.Errorf("CRD has non-boilerplate field %v under 'status'", k)
t.Errorf("CRD has non-boilerplate field '%v' under 'status'", k)
}
}

Expand Down
Loading