Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: switch to mockery config file #9473

Merged
merged 2 commits into from
Jun 5, 2024
Merged

Conversation

ShreyaLnuHpe
Copy link
Contributor

@ShreyaLnuHpe ShreyaLnuHpe commented Jun 5, 2024

Ticket

RM-277

Description

We are transitioning to using a single mockery configuration file to streamline our mock generation process. Currently, we have 18 individual mockery commands, which are time-consuming. By consolidating these into a single configuration file, we can significantly reduce execution time and improve efficiency.

Test Plan

make -C master clean  to delete local mocks

make -C master check to generate mocks (also sometimes make -C master mocks )

make -C master test-intg to make sure mocks are generated right 
ran with devcluster -c ./.circleci/devcluster/elastic-base.devcluster.yaml
and confirmed if the devcluster ran fine - curl -X GET "http://localhost:9200/_cluster/health?pretty"

Checklist

  • Changes have been manually QA'd
  • User-facing API changes need the "User-facing API Change" label.
  • Release notes should be added as a separate file under docs/release-notes/.
    See Release Note for details.
  • Licenses should be included for new code which was copied and/or modified from any external code.

@ShreyaLnuHpe ShreyaLnuHpe requested a review from a team as a code owner June 5, 2024 10:01
@cla-bot cla-bot bot added the cla-signed label Jun 5, 2024
Copy link

codecov bot commented Jun 5, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 49.00%. Comparing base (8d64508) to head (4148fd3).
Report is 3 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #9473      +/-   ##
==========================================
- Coverage   51.06%   49.00%   -2.07%     
==========================================
  Files         747     1234     +487     
  Lines      111186   159690   +48504     
  Branches     2780     2780              
==========================================
+ Hits        56778    78253   +21475     
- Misses      54233    81262   +27029     
  Partials      175      175              
Flag Coverage Δ
backend 43.78% <ø> (+9.54%) ⬆️
harness 64.05% <ø> (+<0.01%) ⬆️
web 44.12% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

see 488 files with indirect coverage changes

Copy link

netlify bot commented Jun 5, 2024

Deploy Preview for determined-ui canceled.

Name Link
🔨 Latest commit 4148fd3
🔍 Latest deploy log https://app.netlify.com/sites/determined-ui/deploys/6660acc1410cbc00081a4404

Copy link
Contributor

@NicholasBlaskey NicholasBlaskey left a comment

Choose a reason for hiding this comment

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

LGTM

thanks for working on this

mockery --quiet --name=CoreV1Interface --output internal/mocks --srcpkg "k8s.io/client-go/kubernetes/typed/core/v1" --filename k8s_corev1_iface.go --structname K8sCoreV1Interface
mockery --quiet --name=BatchV1Interface --output internal/mocks --srcpkg "k8s.io/client-go/kubernetes/typed/batch/v1" --filename k8s_batchv1_iface.go --structname K8sBatchV1Interface

mockery --config "./.mockery.yaml"
Copy link
Contributor

Choose a reason for hiding this comment

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

is the output a lot?

Should we add --quite to this? I am fine either way

Copy link
Contributor Author

Choose a reason for hiding this comment

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

We do not need it as it does not add any noise:

% make -C master check                        
rm -f build/schema_gen.stamp
rm -f ../harness/determined/common/streams/wire.py
rm -f ../webui/react/src/services/stream/wire.ts
../tools/scripts/gen-attributions.py master packaging/LICENSE
go generate ./pkg/schemas/...
mkdir -p build
touch build/schema_gen.stamp
go build -o build/stream-gen ./cmd/stream-gen
build/stream-gen ./internal/stream//authz_basic_impl.go ./internal/stream//subscription.go ./internal/stream//models.go ./internal/stream//test_util.go ./internal/stream//model_versions.go ./internal/stream//util.go ./internal/stream//supervisor.go ./internal/stream//socketlike.go ./internal/stream//messages.go ./internal/stream//projects.go ./internal/stream//authz_iface.go ./internal/stream//publisher.go --python --output ../harness/determined/common/streams/wire.py
build/stream-gen ./internal/stream//authz_basic_impl.go ./internal/stream//subscription.go ./internal/stream//models.go ./internal/stream//test_util.go ./internal/stream//model_versions.go ./internal/stream//util.go ./internal/stream//supervisor.go ./internal/stream//socketlike.go ./internal/stream//messages.go ./internal/stream//projects.go ./internal/stream//authz_iface.go ./internal/stream//publisher.go --ts --output ../webui/react/src/services/stream/wire.ts
mockery --config "./.mockery.yaml"
mkdir -p build
touch build/mock_gen.stamp
# Checking that committed, generated code is up-to-date by ensuring that
# git reports the files as unchanged after forcibly regenerating the files:
test -z "" || (git diff; false)
go mod tidy
git diff --quiet ../go.mod ../go.sum
golangci-lint --build-tags integration run --timeout 10m
WARN [linters_context] running gomodguard failed: unable to parse module file go.mod: go.mod:3: invalid go version '1.22.0': must match format 1.23: if you are not using go modules it is suggested to disable this linter 

packages:
github.com/determined-ai/determined/master/internal/db:
interfaces:
# mockery --quiet --name=DB --dir=internal/db --output internal/mocks --filename db.go
Copy link
Contributor

Choose a reason for hiding this comment

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

I don't think we need these comments

@ShreyaLnuHpe ShreyaLnuHpe merged commit ca03da1 into main Jun 5, 2024
85 of 98 checks passed
@ShreyaLnuHpe ShreyaLnuHpe deleted the shreya/mockeryconfig branch June 5, 2024 19:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants