File: exposer_test.cc

package info (click to toggle)
prometheus-cpp 1.0.2-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 792 kB
  • sloc: cpp: 3,596; sh: 37; makefile: 12
file content (25 lines) | stat: -rw-r--r-- 637 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
#include "prometheus/exposer.h"

#include <gtest/gtest.h>

namespace prometheus {
namespace {

using namespace testing;

TEST(ExposerTest, listenOnDistinctPorts) {
  Exposer firstExposer{"0.0.0.0:0"};
  auto firstExposerPorts = firstExposer.GetListeningPorts();
  ASSERT_EQ(1u, firstExposerPorts.size());
  EXPECT_NE(0, firstExposerPorts.front());

  Exposer secondExposer{"0.0.0.0:0"};
  auto secondExposerPorts = secondExposer.GetListeningPorts();
  ASSERT_EQ(1u, secondExposerPorts.size());
  EXPECT_NE(0, secondExposerPorts.front());

  EXPECT_NE(firstExposerPorts, secondExposerPorts);
}

}  // namespace
}  // namespace prometheus