Skip to content

Conversation

jaypipes
Copy link
Collaborator

@jaypipes jaypipes commented Dec 8, 2022

Attempting to generate the SNS controller with code-generator <=
v0.21.0 results in various make test failures that look like this:

[jaypipes@thelio sns-controller]$ make test
go test -v ./...
?   	github.com/aws-controllers-k8s/sns-controller/apis/v1alpha1	[no test files]
pkg/resource/topic/sdk.go:225:8: undefined: err
pkg/resource/platform_application/sdk.go:75:6: resp declared but not used
pkg/resource/platform_application/sdk.go:217:8: undefined: err
pkg/resource/platform_endpoint/sdk.go:75:6: resp declared but not used
pkg/resource/platform_endpoint/sdk.go:113:48: r.ko.Spec.EndpointARN undefined (type "github.com/aws-controllers-k8s/sns-controller/apis/v1alpha1".PlatformEndpointSpec has no field or method EndpointARN)
pkg/resource/platform_endpoint/sdk.go:202:8: undefined: err
pkg/resource/platform_endpoint/sdk.go:270:48: r.ko.Spec.EndpointARN undefined (type "github.com/aws-controllers-k8s/sns-controller/apis/v1alpha1".PlatformEndpointSpec has no field or method EndpointARN)
make: *** [Makefile:19: test] Error 2

We were not including Spec fields in the processing of
SetResourceGetAttributes, which resulted in a bunch of resp variable declared and not used compile-time failures. This patch fixes that by
pulling attributes from the resulting Attributes map into Spec fields
when the field is_read_only=false.

In addition, fixes the template for sdk_update_set_attributes to declare
an err variable before referencing it.

Signed-off-by: Jay Pipes [email protected]

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

Copy link
Contributor

@jljaco jljaco left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you please mention in the PR description how we could go about reproducing the compilation error(s) that prompted this change? Which version of code-generator and which controller?

@jaypipes
Copy link
Collaborator Author

jaypipes commented Dec 8, 2022

Could you please mention in the PR description how we could go about reproducing the compilation error(s) that prompted this change? Which version of code-generator and which controller?

Could you please mention in the PR description how we could go about reproducing the compilation error(s) that prompted this change? Which version of code-generator and which controller?

done! :)

Attempting to generate the SNS controller with code-generator <=
v0.21.0 results in various `make test` failures that look like this:

```
[jaypipes@thelio sns-controller]$ make test
go test -v ./...
?   	github.com/aws-controllers-k8s/sns-controller/apis/v1alpha1	[no test files]
pkg/resource/topic/sdk.go:225:8: undefined: err
pkg/resource/platform_application/sdk.go:75:6: resp declared but not used
pkg/resource/platform_application/sdk.go:217:8: undefined: err
pkg/resource/platform_endpoint/sdk.go:75:6: resp declared but not used
pkg/resource/platform_endpoint/sdk.go:113:48: r.ko.Spec.EndpointARN undefined (type "github.com/aws-controllers-k8s/sns-controller/apis/v1alpha1".PlatformEndpointSpec has no field or method EndpointARN)
pkg/resource/platform_endpoint/sdk.go:202:8: undefined: err
pkg/resource/platform_endpoint/sdk.go:270:48: r.ko.Spec.EndpointARN undefined (type "github.com/aws-controllers-k8s/sns-controller/apis/v1alpha1".PlatformEndpointSpec has no field or method EndpointARN)
make: *** [Makefile:19: test] Error 2
```

We were not including Spec fields in the processing of
SetResourceGetAttributes, which resulted in a bunch of `resp variable
declared and not used` compile-time failures. This patch fixes that by
pulling attributes from the resulting Attributes map into Spec fields
when the field is_read_only=false.

In addition, fixes the template for sdk_update_set_attributes to declare
an `err` variable before referencing it.

Signed-off-by: Jay Pipes <[email protected]>
Copy link
Contributor

@RedbackThomson RedbackThomson left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm :)

@ack-bot
Copy link
Collaborator

ack-bot commented Dec 8, 2022

@jaypipes: The following test failed, say /retest to rerun all failed tests:

Test name Commit Details Rerun command
dynamodb-controller-test 284927e link /test dynamodb-controller-test

Full PR test history. Your PR dashboard.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. I understand the commands that are listed here.

Copy link
Member

@a-hilaly a-hilaly left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Alles gut!
/retest
/lgtm

@ack-bot ack-bot added the lgtm Indicates that a PR is ready to be merged. label Dec 8, 2022
@ack-bot
Copy link
Collaborator

ack-bot commented Dec 8, 2022

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: A-Hilaly, jaypipes, RedbackThomson

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:
  • OWNERS [A-Hilaly,RedbackThomson,jaypipes]

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@ack-bot ack-bot merged commit 39d7c30 into aws-controllers-k8s:main Dec 8, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approved lgtm Indicates that a PR is ready to be merged.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants