kubernetes-sigs / cluster-api-provider-aws

Kubernetes Cluster API Provider AWS provides consistent deployment and day 2 operations of "self-managed" and EKS Kubernetes clusters on AWS.
http://cluster-api-aws.sigs.k8s.io/
Apache License 2.0
646 stars 575 forks source link

Mocks don't get updated #379

Closed vincepri closed 6 years ago

vincepri commented 6 years ago

/kind bug

Describe the solution you'd like: Currently the mocks seem to be static and they don't get updated automatically when running the generate command. We should provide a way to update mocks automatically when changes are detected running generate.

vincepri commented 6 years ago

@randomvariable do you think you can take a look at this?

randomvariable commented 6 years ago

Do you mean with go generate? If so, it's quite slow to do it using go generate (up to 30s), so was relying on Bazel's cache.

vincepri commented 6 years ago

For mocks we originally used mockgen but I don't see any references in the Bazel code now, I see a file under build/ but I'm not sure how to call it and regenerate the mocks.

randomvariable commented 6 years ago

Ah, ok. Probably documentation more than anything to start off with:

# Example mock generation
bazel build //cluster-api-provider-aws/pkg/cloud/aws/actuators/cluster/mock_clusteriface:go_default_library

# Repeat for others or just do all the tests, which will automatically generate the mocks

bazel test //pkg/...

# Copy generated mocks into the repo:
make copy-genmocks
randomvariable commented 6 years ago

And to add / modify what gets mocked: https://github.com/kubernetes-sigs/cluster-api-provider-aws/tree/master/build#go_mock

vincepri commented 6 years ago

Should we make this part of the generate step? This PR #380 removes the actuator mocks, which aren't used anymore, so it should be doable to just add the ec2 sdk mocks, what do you think?

randomvariable commented 6 years ago

maybe. i'll try something out and you can see if the ux is acceptable.

/lifecycle active

randomvariable commented 6 years ago

/assign

vincepri commented 6 years ago

Fixed in #389 /close

k8s-ci-robot commented 6 years ago

@vincepri: Closing this issue.

In response to [this](https://github.com/kubernetes-sigs/cluster-api-provider-aws/issues/379#issuecomment-439978887): >Fixed in #389 >/close Instructions for interacting with me using PR comments are available [here](https://git.k8s.io/community/contributors/guide/pull-requests.md). If you have questions or suggestions related to my behavior, please file an issue against the [kubernetes/test-infra](https://github.com/kubernetes/test-infra/issues/new?title=Prow%20issue:) repository.