Skip to content

Commit

Permalink
Merge pull request GoogleCloudPlatform#2676 from GoogleCloudPlatform/…
Browse files Browse the repository at this point in the history
…acpana/direct-promos3

tests: direct changes
  • Loading branch information
google-oss-prow[bot] committed Sep 11, 2024
2 parents e4bf65d + 4aff91a commit a4e0f93
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
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

0 comments on commit a4e0f93

Please sign in to comment.