-
Notifications
You must be signed in to change notification settings - Fork 91
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add failure tests for the transformer
Signed-off-by: Alper Rifat Ulucinar <[email protected]>
- Loading branch information
Showing
4 changed files
with
75 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
42 changes: 42 additions & 0 deletions
42
pkg/transformers/testdata/missing_list_type.resolvers.go.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
/* | ||
Copyright 2022 Upbound Inc. | ||
*/ | ||
// Code generated by angryjet. DO NOT EDIT. | ||
|
||
package v1beta1 | ||
|
||
import ( | ||
"context" | ||
reference "github.com/crossplane/crossplane-runtime/pkg/reference" | ||
resource "github.com/crossplane/upjet/pkg/resource" | ||
errors "github.com/pkg/errors" | ||
client "sigs.k8s.io/controller-runtime/pkg/client" | ||
) | ||
|
||
// ResolveReferences of this Feature. | ||
func (mg *Feature) ResolveReferences(ctx context.Context, c client.Reader) error { | ||
r := reference.NewAPIResolver(c, mg) | ||
|
||
var rsp reference.ResolutionResponse | ||
var err error | ||
|
||
rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ | ||
CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.Project), | ||
Extract: resource.ExtractParamPath("name", false), | ||
Reference: mg.Spec.ForProvider.ProjectRef, | ||
Selector: mg.Spec.ForProvider.ProjectSelector, | ||
// Please note the missing List type in the below expression | ||
// This is not expected for the generated resolver | ||
// implementations by angryjet. | ||
To: reference.To{ | ||
Managed: &Project{}, | ||
}, | ||
}) | ||
if err != nil { | ||
return errors.Wrap(err, "mg.Spec.ForProvider.Project") | ||
} | ||
mg.Spec.ForProvider.Project = reference.ToPtrValue(rsp.ResolvedValue) | ||
mg.Spec.ForProvider.ProjectRef = rsp.ResolvedReference | ||
|
||
return nil | ||
} |