Closed vincepri closed 6 years ago
@randomvariable do you think you can take a look at this?
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.
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.
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
And to add / modify what gets mocked: https://github.com/kubernetes-sigs/cluster-api-provider-aws/tree/master/build#go_mock
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?
maybe. i'll try something out and you can see if the ux is acceptable.
/lifecycle active
/assign
Fixed in #389 /close
@vincepri: Closing this issue.
/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.