Repository: weaviate/weaviate
Pull request #7835: Use snake case to name mock files
Author: login: salvatore-campagna-weaviate
Created: 2025-04-15T13:31:24Z | Merged: 2025-04-16T10:17:45Z

This PR configures Mockery to generate mocks with file names that follow our naming convention, using snake case for file names.

The struct names remain unchanged, ensuring there are no issues with existing code dependencies.

### Review checklist

- [ ] Documentation has been updated, if necessary. Link to changed documentation:
- [ ] Chaos pipeline run or not necessary. Link to pipeline:
- [ ] All new code is covered by tests where it is reasonable.
- [ ] Performance tests have been run or not necessary.


Diff:
diff --git a/.mockery.yaml b/.mockery.yaml
index 26f4dcac8d3..bed37c665cd 100644
--- a/.mockery.yaml
+++ b/.mockery.yaml
@@ -2,7 +2,7 @@ with-expecter: True
 dir: mocks/{{ replaceAll .InterfaceDirRelative "internal" "internal_" }}
 mockname: "{{.InterfaceName}}"
 outpkg: "{{.PackageName}}"
-filename: "{{.InterfaceName}}.go"
+filename: "{{ snakecase .InterfaceName }}.go"
 recursive: true
 packages:
   github.com/weaviate/weaviate/cluster/replication/types:
diff --git a/mocks/cluster/replication/types/ReplicationDetailsProvider.go b/mocks/cluster/replication/types/ReplicationDetailsProvider.go
deleted file mode 100644
index 9c049505aec..00000000000
--- a/mocks/cluster/replication/types/ReplicationDetailsProvider.go
+++ /dev/null
@@ -1,102 +0,0 @@
-//                           _       _
-// __      _____  __ ___   ___  __ _| |_ ___
-// \ \ /\ / / _ \/ _` \ \ / / |/ _` | __/ _ \
-//  \ V  V /  __/ (_| |\ V /| | (_| | ||  __/
-//   \_/\_/ \___|\__,_| \_/ |_|\__,_|\__\___|
-//
-//  Copyright © 2016 - 2024 Weaviate B.V. All rights reserved.
-//
-//  CONTACT: hello@weaviate.io
-//
-
-// Code generated by mockery v2.53.2. DO NOT EDIT.
-
-package types
-
-import (
-	mock "github.com/stretchr/testify/mock"
-	api "github.com/weaviate/weaviate/cluster/proto/api"
-)
-
-// ReplicationDetailsProvider is an autogenerated mock type for the ReplicationDetailsProvider type
-type ReplicationDetailsProvider struct {
-	mock.Mock
-}
-
-type ReplicationDetailsProvider_Expecter struct {
-	mock *mock.Mock
-}
-
-func (_m *ReplicationDetailsProvider) EXPECT() *ReplicationDetailsProvider_Expecter {
-	return &ReplicationDetailsProvider_Expecter{mock: &_m.Mock}
-}
-
-// GetReplicationDetailsByReplicationId provides a mock function with given fields: id
-func (_m *ReplicationDetailsProvider) GetReplicationDetailsByReplicationId(id uint64) (api.ReplicationDetailsResponse, error) {
-	ret := _m.Called(id)
-
-	if len(ret) == 0 {
-		panic("no return value specified for GetReplicationDetailsByReplicationId")
-	}
-
-	var r0 api.ReplicationDetailsResponse
-	var r1 error
-	if rf, ok := ret.Get(0).(func(uint64) (api.ReplicationDetailsResponse, error)); ok {
-		return rf(id)
-	}
-	if rf, ok := ret.Get(0).(func(uint64) api.ReplicationDetailsResponse); ok {
-		r0 = rf(id)
-	} else {
-		r0 = ret.Get(0).(api.ReplicationDetailsResponse)
-	}
-
-	if rf, ok := ret.Get(1).(func(uint64) error); ok {
-		r1 = rf(id)
-	} else {
-		r1 = ret.Error(1)
-	}
-
-	return r0, r1
-}
-
-// ReplicationDetailsProvider_GetReplicationDetailsByReplicationId_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetReplicationDetailsByReplicationId'
-type ReplicationDetailsProvider_GetReplicationDetailsByReplicationId_Call struct {
-	*mock.Call
-}
-
-// GetReplicationDetailsByReplicationId is a helper method to define mock.On call
-//   - id uint64
-func (_e *ReplicationDetailsProvider_Expecter) GetReplicationDetailsByReplicationId(id interface{}) *ReplicationDetailsProvider_GetReplicationDetailsByReplicationId_Call {
-	return &ReplicationDetailsProvider_GetReplicationDetailsByReplicationId_Call{Call: _e.mock.On("GetReplicationDetailsByReplicationId", id)}
-}
-
-func (_c *ReplicationDetailsProvider_GetReplicationDetailsByReplicationId_Call) Run(run func(id uint64)) *ReplicationDetailsProvider_GetReplicationDetailsByReplicationId_Call {
-	_c.Call.Run(func(args mock.Arguments) {
-		run(args[0].(uint64))
-	})
-	return _c
-}
-
-func (_c *ReplicationDetailsProvider_GetReplicationDetailsByReplicationId_Call) Return(_a0 api.ReplicationDetailsResponse, _a1 error) *ReplicationDetailsProvider_GetReplicationDetailsByReplicationId_Call {
-	_c.Call.Return(_a0, _a1)
-	return _c
-}
-
-func (_c *ReplicationDetailsProvider_GetReplicationDetailsByReplicationId_Call) RunAndReturn(run func(uint64) (api.ReplicationDetailsResponse, error)) *ReplicationDetailsProvider_GetReplicationDetailsByReplicationId_Call {
-	_c.Call.Return(run)
-	return _c
-}
-
-// NewReplicationDetailsProvider creates a new instance of ReplicationDetailsProvider. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations.
-// The first argument is typically a *testing.T value.
-func NewReplicationDetailsProvider(t interface {
-	mock.TestingT
-	Cleanup(func())
-}) *ReplicationDetailsProvider {
-	mock := &ReplicationDetailsProvider{}
-	mock.Mock.Test(t)
-
-	t.Cleanup(func() { mock.AssertExpectations(t) })
-
-	return mock
-}
diff --git a/mocks/cluster/replication/types/Manager.go b/mocks/cluster/replication/types/manager.go
similarity index 100%
rename from mocks/cluster/replication/types/Manager.go
rename to mocks/cluster/replication/types/manager.go
diff --git a/mocks/cluster/replication/types/ReplicationFSMReader.go b/mocks/cluster/replication/types/replication_fsm_reader.go
similarity index 100%
rename from mocks/cluster/replication/types/ReplicationFSMReader.go
rename to mocks/cluster/replication/types/replication_fsm_reader.go
diff --git a/mocks/cluster/schema/types/SchemaReader.go b/mocks/cluster/schema/types/schema_reader.go
similarity index 100%
rename from mocks/cluster/schema/types/SchemaReader.go
rename to mocks/cluster/schema/types/schema_reader.go
diff --git a/mocks/usecases/auth/authorization/Authorizer.go b/mocks/usecases/auth/authorization/authorizer.go
similarity index 100%
rename from mocks/usecases/auth/authorization/Authorizer.go
rename to mocks/usecases/auth/authorization/authorizer.go


Reviews:
user: login: orca-security-eu[bot]
body: ### Orca Security Scan Summary
| Status  | Check | Issues by priority |   |
| ------- | ----- | ------------------ | - |
| <img width="16" alt="Passed" src="https://raw.githubusercontent.com/orcasecurity/orca-cli/main/resources/images/prcomment/status_v1/passed.png" title="Passed"> Passed | Infrastructure as Code | <img width="12" alt="high" src="https://raw.githubusercontent.com/orcasecurity/orca-cli/main/resources/images/prcomment/priority/high.png" title="High"> 0 &emsp; <img width="12" alt="medium" src="https://raw.githubusercontent.com/orcasecurity/orca-cli/main/resources/images/prcomment/priority/medium.png" title="Medium"> 0 &emsp; <img width="12" alt="low" src="https://raw.githubusercontent.com/orcasecurity/orca-cli/main/resources/images/prcomment/priority/low.png" title="Low"> 0 &emsp; <img width="12" alt="info" src="https://raw.githubusercontent.com/orcasecurity/orca-cli/main/resources/images/prcomment/priority/info.png" title="Info"> 0 | <a href="https://eu.app.orcasecurity.io/shift-left/iac/scan-log/e62df22b-9544-4167-bd4e-25cbd94d25b0" target="_blank">View in Orca</a> |
| <img width="16" alt="Passed" src="https://raw.githubusercontent.com/orcasecurity/orca-cli/main/resources/images/prcomment/status_v1/passed.png" title="Passed"> Passed | SAST | <img width="12" alt="high" src="https://raw.githubusercontent.com/orcasecurity/orca-cli/main/resources/images/prcomment/priority/high.png" title="High"> 0 &emsp; <img width="12" alt="medium" src="https://raw.githubusercontent.com/orcasecurity/orca-cli/main/resources/images/prcomment/priority/medium.png" title="Medium"> 0 &emsp; <img width="12" alt="low" src="https://raw.githubusercontent.com/orcasecurity/orca-cli/main/resources/images/prcomment/priority/low.png" title="Low"> 0 &emsp; <img width="12" alt="info" src="https://raw.githubusercontent.com/orcasecurity/orca-cli/main/resources/images/prcomment/priority/info.png" title="Info"> 0 | <a href="https://eu.app.orcasecurity.io/shift-left/sast/scan-log/b6ade9f5-8046-4f04-b359-e14a1ec37a1c" target="_blank">View in Orca</a> |
| <img width="16" alt="Passed" src="https://raw.githubusercontent.com/orcasecurity/orca-cli/main/resources/images/prcomment/status_v1/passed.png" title="Passed"> Passed | Secrets | <img width="12" alt="high" src="https://raw.githubusercontent.com/orcasecurity/orca-cli/main/resources/images/prcomment/priority/high.png" title="High"> 0 &emsp; <img width="12" alt="medium" src="https://raw.githubusercontent.com/orcasecurity/orca-cli/main/resources/images/prcomment/priority/medium.png" title="Medium"> 0 &emsp; <img width="12" alt="low" src="https://raw.githubusercontent.com/orcasecurity/orca-cli/main/resources/images/prcomment/priority/low.png" title="Low"> 0 &emsp; <img width="12" alt="info" src="https://raw.githubusercontent.com/orcasecurity/orca-cli/main/resources/images/prcomment/priority/info.png" title="Info"> 0 | <a href="https://eu.app.orcasecurity.io/shift-left/file_system_secret_detection/scan-log/c81606f5-62fd-41b0-ad10-5bf1bb7ffc98" target="_blank">View in Orca</a> |
| <img width="16" alt="Passed" src="https://raw.githubusercontent.com/orcasecurity/orca-cli/main/resources/images/prcomment/status_v1/passed.png" title="Passed"> Passed | Vulnerabilities | <img width="12" alt="high" src="https://raw.githubusercontent.com/orcasecurity/orca-cli/main/resources/images/prcomment/priority/high.png" title="High"> 0 &emsp; <img width="12" alt="medium" src="https://raw.githubusercontent.com/orcasecurity/orca-cli/main/resources/images/prcomment/priority/medium.png" title="Medium"> 0 &emsp; <img width="12" alt="low" src="https://raw.githubusercontent.com/orcasecurity/orca-cli/main/resources/images/prcomment/priority/low.png" title="Low"> 0 &emsp; <img width="12" alt="info" src="https://raw.githubusercontent.com/orcasecurity/orca-cli/main/resources/images/prcomment/priority/info.png" title="Info"> 0 | <a href="https://eu.app.orcasecurity.io/shift-left/file_system_vulnerabilities/scan-log/244ef898-d6b7-4c16-a73a-704a65e208ef" target="_blank">View in Orca</a> |
state: COMMENTED
author_association: NONE
submitted_at: 2025-04-15T13:32:20Z
user: login: faustuzas
state: COMMENTED
author_association: CONTRIBUTOR
submitted_at: 2025-04-16T08:39:08Z
user: login: faustuzas
state: COMMENTED
author_association: CONTRIBUTOR
submitted_at: 2025-04-16T08:39:23Z
user: login: salvatore-campagna-weaviate
state: COMMENTED
author_association: CONTRIBUTOR
submitted_at: 2025-04-16T09:21:04Z
user: login: faustuzas
state: APPROVED
author_association: CONTRIBUTOR
submitted_at: 2025-04-16T09:50:16Z

Review comments:
diff_hunk: @@ -2,16 +2,23 @@ with-expecter: True
 dir: mocks/{{ replaceAll .InterfaceDirRelative "internal" "internal_" }}
 mockname: "{{.InterfaceName}}"
 outpkg: "{{.PackageName}}"
-filename: "{{.InterfaceName}}.go"
path: .mockery.yaml
user: login: faustuzas
body: You should be able to do to automate this
```go
filename: "{{.InterfaceName | snakecase }}.go"
```
created_at: 2025-04-16T08:39:07Z
author_association: CONTRIBUTOR
diff_hunk: @@ -2,16 +2,23 @@ with-expecter: True
 dir: mocks/{{ replaceAll .InterfaceDirRelative "internal" "internal_" }}
 mockname: "{{.InterfaceName}}"
 outpkg: "{{.PackageName}}"
-filename: "{{.InterfaceName}}.go"
path: .mockery.yaml
user: login: faustuzas
body: as the mockery provides this function: https://github.com/vektra/mockery/blob/v3/template_funcs/funcmap.go#L49
created_at: 2025-04-16T08:39:23Z
author_association: CONTRIBUTOR
diff_hunk: @@ -2,16 +2,23 @@ with-expecter: True
 dir: mocks/{{ replaceAll .InterfaceDirRelative "internal" "internal_" }}
 mockname: "{{.InterfaceName}}"
 outpkg: "{{.PackageName}}"
-filename: "{{.InterfaceName}}.go"
path: .mockery.yaml
user: login: salvatore-campagna-weaviate
body: Done. Thank you.
created_at: 2025-04-16T09:21:04Z
author_association: CONTRIBUTOR

PR comments:
user: login: sonarqubecloud[bot]
created_at: 2025-04-16T09:46:49Z
body: ## [![Quality Gate Failed](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/QualityGateBadge/qg-failed-20px.png 'Quality Gate Failed')](https://sonarcloud.io/dashboard?id=weaviate_weaviate&pullRequest=7835) **Quality Gate failed**  
Failed conditions  
![](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/failed-16px.png '') [8.0% Duplication on New Code](https://sonarcloud.io/component_measures?id=weaviate_weaviate&pullRequest=7835&metric=new_duplicated_lines_density&view=list) (required ≤ 3%)  
  
[See analysis details on SonarQube Cloud](https://sonarcloud.io/dashboard?id=weaviate_weaviate&pullRequest=7835)


author_association: NONE
user: login: weaviate-git-bot
created_at: 2025-04-16T10:00:10Z
body: Great to see you again! Thanks for the contribution.<br><br>beep boop - the Weaviate bot 👋🤖<br><br>PS:<br>Are you already a member of the <a target="_blank" href="https://weaviate.io/slack">Weaviate Slack channel?</a>
author_association: NONE