From a31f5064e34ba32b03493f9558ad118b4527952a Mon Sep 17 00:00:00 2001 From: jeremyh Date: Thu, 7 Sep 2023 11:51:30 -0400 Subject: [PATCH 1/4] fix exporting of NewMockClient by refactoring to newMockClient --- receiver/nsxtreceiver/client_mock_test.go | 4 ++-- receiver/nsxtreceiver/scraper_test.go | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/receiver/nsxtreceiver/client_mock_test.go b/receiver/nsxtreceiver/client_mock_test.go index 16ba9a53a3f4..f2cd4fe60890 100644 --- a/receiver/nsxtreceiver/client_mock_test.go +++ b/receiver/nsxtreceiver/client_mock_test.go @@ -132,8 +132,8 @@ func (m *MockClient) TransportNodes(ctx context.Context) ([]model.TransportNode, return r0, r1 } -// NewMockClient creates a new instance of MockClient. It also registers the testing.TB interface on the mock and a cleanup function to assert the mocks expectations. -func NewMockClient(t testing.TB) *MockClient { +// newMockClient creates a new instance of MockClient. It also registers the testing.TB interface on the mock and a cleanup function to assert the mocks expectations. +func newMockClient(t testing.TB) *MockClient { mock := &MockClient{} mock.Mock.Test(t) diff --git a/receiver/nsxtreceiver/scraper_test.go b/receiver/nsxtreceiver/scraper_test.go index df9a53561896..bf0887e087d4 100644 --- a/receiver/nsxtreceiver/scraper_test.go +++ b/receiver/nsxtreceiver/scraper_test.go @@ -25,7 +25,7 @@ import ( ) func TestScrape(t *testing.T) { - mockClient := NewMockClient(t) + mockClient := newMockClient(t) mockClient.On("ClusterNodes", mock.Anything).Return(loadTestClusterNodes()) mockClient.On("TransportNodes", mock.Anything).Return(loadTestTransportNodes()) @@ -68,7 +68,7 @@ func TestScrape(t *testing.T) { } func TestScrapeTransportNodeErrors(t *testing.T) { - mockClient := NewMockClient(t) + mockClient := newMockClient(t) mockClient.On("TransportNodes", mock.Anything).Return(nil, errUnauthorized) scraper := newScraper( &Config{ @@ -84,7 +84,7 @@ func TestScrapeTransportNodeErrors(t *testing.T) { } func TestScrapeClusterNodeErrors(t *testing.T) { - mockClient := NewMockClient(t) + mockClient := newMockClient(t) mockClient.On("ClusterNodes", mock.Anything).Return(nil, errUnauthorized) mockClient.On("TransportNodes", mock.Anything).Return(loadTestTransportNodes()) From 7565fbfc22e97233f7d909178a098a6559cd64a3 Mon Sep 17 00:00:00 2001 From: jeremyh Date: Thu, 7 Sep 2023 11:53:24 -0400 Subject: [PATCH 2/4] upate allowlist.txt and add changelog --- .chloggen/26304-checkapi-nsxtreceiver.yaml | 27 ++++++++++++++++++++++ cmd/checkapi/allowlist.txt | 1 - 2 files changed, 27 insertions(+), 1 deletion(-) create mode 100755 .chloggen/26304-checkapi-nsxtreceiver.yaml diff --git a/.chloggen/26304-checkapi-nsxtreceiver.yaml b/.chloggen/26304-checkapi-nsxtreceiver.yaml new file mode 100755 index 000000000000..179eafbd2435 --- /dev/null +++ b/.chloggen/26304-checkapi-nsxtreceiver.yaml @@ -0,0 +1,27 @@ +# Use this changelog template to create an entry for release notes. + +# One of 'breaking', 'deprecation', 'new_component', 'enhancement', 'bug_fix' +change_type: breaking + +# The name of the component, or a single word describing the area of concern, (e.g. filelogreceiver) +component: nsxtreceiver + +# A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`). +note: + +# Mandatory: One or more tracking issues related to the change. You can use the PR number here if no issue exists. +issues: [26304] + +# (Optional) One or more lines of additional information to render under the primary note. +# These lines will be padded with 2 spaces and then inserted directly into the document. +# Use pipe (|) for multiline entries. +subtext: + +# If your change doesn't affect end users or the exported elements of any package, +# you should instead start your pull request title with [chore] or use the "Skip Changelog" label. +# Optional: The change log or logs in which this entry should be included. +# e.g. '[user]' or '[user, api]' +# Include 'user' if the change is relevant to end users. +# Include 'api' if there is a change to a library API. +# Default: '[user]' +change_logs: [api] diff --git a/cmd/checkapi/allowlist.txt b/cmd/checkapi/allowlist.txt index 72745f041595..679e4b2dcc2f 100644 --- a/cmd/checkapi/allowlist.txt +++ b/cmd/checkapi/allowlist.txt @@ -31,7 +31,6 @@ receiver/kafkareceiver receiver/mongodbatlasreceiver receiver/mongodbreceiver receiver/mysqlreceiver -receiver/nsxtreceiver receiver/podmanreceiver receiver/pulsarreceiver receiver/windowseventlogreceiver \ No newline at end of file From 915d8e0632c1e775fbf5ac5afdf259687c8d3c6e Mon Sep 17 00:00:00 2001 From: jeremyh Date: Thu, 7 Sep 2023 12:07:01 -0400 Subject: [PATCH 3/4] add note to chlog --- .chloggen/26304-checkapi-nsxtreceiver.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.chloggen/26304-checkapi-nsxtreceiver.yaml b/.chloggen/26304-checkapi-nsxtreceiver.yaml index 179eafbd2435..9e7ca31c5ced 100755 --- a/.chloggen/26304-checkapi-nsxtreceiver.yaml +++ b/.chloggen/26304-checkapi-nsxtreceiver.yaml @@ -7,7 +7,7 @@ change_type: breaking component: nsxtreceiver # A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`). -note: +note: do not export `NewMockClient` # Mandatory: One or more tracking issues related to the change. You can use the PR number here if no issue exists. issues: [26304] From bd260bb87e506eded943e0181790cff7ffb0b53c Mon Sep 17 00:00:00 2001 From: jeremyh Date: Thu, 7 Sep 2023 14:37:24 -0400 Subject: [PATCH 4/4] remove changelog as the change is only in tests and non-breaking --- .chloggen/26304-checkapi-nsxtreceiver.yaml | 27 ---------------------- 1 file changed, 27 deletions(-) delete mode 100755 .chloggen/26304-checkapi-nsxtreceiver.yaml diff --git a/.chloggen/26304-checkapi-nsxtreceiver.yaml b/.chloggen/26304-checkapi-nsxtreceiver.yaml deleted file mode 100755 index 9e7ca31c5ced..000000000000 --- a/.chloggen/26304-checkapi-nsxtreceiver.yaml +++ /dev/null @@ -1,27 +0,0 @@ -# Use this changelog template to create an entry for release notes. - -# One of 'breaking', 'deprecation', 'new_component', 'enhancement', 'bug_fix' -change_type: breaking - -# The name of the component, or a single word describing the area of concern, (e.g. filelogreceiver) -component: nsxtreceiver - -# A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`). -note: do not export `NewMockClient` - -# Mandatory: One or more tracking issues related to the change. You can use the PR number here if no issue exists. -issues: [26304] - -# (Optional) One or more lines of additional information to render under the primary note. -# These lines will be padded with 2 spaces and then inserted directly into the document. -# Use pipe (|) for multiline entries. -subtext: - -# If your change doesn't affect end users or the exported elements of any package, -# you should instead start your pull request title with [chore] or use the "Skip Changelog" label. -# Optional: The change log or logs in which this entry should be included. -# e.g. '[user]' or '[user, api]' -# Include 'user' if the change is relevant to end users. -# Include 'api' if there is a change to a library API. -# Default: '[user]' -change_logs: [api]