Skip to content

Commit

Permalink
Make CollectorConfig members private
Browse files Browse the repository at this point in the history
  • Loading branch information
Molter73 committed Oct 14, 2024
1 parent ed2647f commit 8381c18
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 16 deletions.
3 changes: 2 additions & 1 deletion collector/lib/CollectorConfig.h
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ class CollectorConfig {

std::shared_ptr<grpc::Channel> grpc_channel;

protected:
private:
int scrape_interval_;
CollectionMethod collection_method_;
bool turn_off_scrape_;
Expand Down Expand Up @@ -220,6 +220,7 @@ class CollectorConfig {
FRIEND_TEST(CollectorConfigTest, TestYamlConfigToConfigMultiple);
FRIEND_TEST(CollectorConfigTest, TestYamlConfigToConfigInvalid);
FRIEND_TEST(CollectorConfigTest, TestYamlConfigToConfigEmpty);
FRIEND_TEST(NetworkStatusNotifier, UpdateIPnoAfterglow);
};

std::ostream& operator<<(std::ostream& os, const CollectorConfig& c);
Expand Down
17 changes: 2 additions & 15 deletions collector/test/NetworkStatusNotifierTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,6 @@

namespace collector {

namespace {

using grpc_duplex_impl::Result;
using grpc_duplex_impl::Status;
using ::testing::Invoke;
Expand Down Expand Up @@ -68,15 +66,6 @@ class Semaphore {
std::mutex mutex_;
};

class MockCollectorConfig : public collector::CollectorConfig {
public:
MockCollectorConfig() : collector::CollectorConfig() {}

void DisableAfterglow() {
enable_afterglow_ = false;
}
};

class MockConnScraper : public IConnScraper {
public:
MOCK_METHOD(bool, Scrape, (std::vector<Connection> * connections, std::vector<ContainerEndpoint>* listen_endpoints), (override));
Expand Down Expand Up @@ -245,8 +234,8 @@ TEST(NetworkStatusNotifier, SimpleStartStop) {
- we check that the former declared connection is deleted and redeclared as part of this network */
TEST(NetworkStatusNotifier, UpdateIPnoAfterglow) {
bool running = true;
MockCollectorConfig config;
config.DisableAfterglow();
CollectorConfig config;
config.enable_afterglow_ = false;
std::shared_ptr<MockConnScraper> conn_scraper = std::make_shared<MockConnScraper>();
auto conn_tracker = std::make_shared<ConnectionTracker>();
auto comm = std::make_shared<MockNetworkConnectionInfoServiceComm>();
Expand Down Expand Up @@ -337,6 +326,4 @@ TEST(NetworkStatusNotifier, UpdateIPnoAfterglow) {
net_status_notifier->Stop();
}

} // namespace

} // namespace collector

0 comments on commit 8381c18

Please sign in to comment.