]> git.ipfire.org Git - thirdparty/pdns.git/commitdiff
TeeAction: make getStats() order deterministic
authorChris Hofstaedtler <chris.hofstaedtler@deduktiva.com>
Mon, 5 Mar 2018 11:21:57 +0000 (12:21 +0100)
committerChris Hofstaedtler <chris.hofstaedtler@deduktiva.com>
Mon, 5 Mar 2018 11:21:57 +0000 (12:21 +0100)
pdns/dnsdist-lua-actions.cc
pdns/dnsdist.hh
regression-tests.dnsdist/test_TeeAction.py

index 4be1d0302e5e8fe47728d29dcffc508a510dc366..9a9339f495fb8c1c4d0359ab6eb9aeb072837af2 100644 (file)
@@ -103,7 +103,7 @@ public:
   ~TeeAction() override;
   DNSAction::Action operator()(DNSQuestion* dq, string* ruleresult) const override;
   string toString() const override;
-  std::unordered_map<string, double> getStats() const override;
+  std::map<string, double> getStats() const override;
 
 private:
   ComboAddress d_remote;
@@ -181,7 +181,7 @@ string TeeAction::toString() const
   return "tee to "+d_remote.toStringWithPort();
 }
 
-std::unordered_map<string,double> TeeAction::getStats() const
+std::map<string,double> TeeAction::getStats() const
 {
   return {{"queries", d_queries},
           {"responses", d_responses},
index d9fa51d96bb64571828b1e5076b05f0e906a5e36..d4e91232d8c87b21cf6d986002bf8becb7e01a8c 100644 (file)
@@ -108,7 +108,7 @@ public:
   {
   }
   virtual string toString() const = 0;
-  virtual std::unordered_map<string, double> getStats() const 
+  virtual std::map<string, double> getStats() const
   {
     return {{}};
   }
index 905f348455428d2b4e9f4edac28d2ae4948b0d02..3d744102816618e1c42e9940612e82422b5e8591 100644 (file)
@@ -73,16 +73,16 @@ class TestTeeAction(DNSDistTest):
 
         # check the TeeAction stats
         stats = self.sendConsoleCommand("getAction(0):printStats()")
-        self.assertEquals(stats, """refuseds\t0
+        self.assertEquals(stats, """noerrors\t%d
 nxdomains\t0
-noerrors\t%d
-servfails\t0
+other-rcode\t0
+queries\t%d
 recv-errors\t0
-tcp-drops\t0
+refuseds\t0
 responses\t%d
-other-rcode\t0
 send-errors\t0
-queries\t%d
+servfails\t0
+tcp-drops\t0
 """ % (numberOfQueries, numberOfQueries, numberOfQueries))
 
     def testTeeWithoutECS(self):
@@ -121,14 +121,14 @@ queries\t%d
 
         # check the TeeAction stats
         stats = self.sendConsoleCommand("getAction(0):printStats()")
-        self.assertEquals(stats, """refuseds\t0
+        self.assertEquals(stats, """noerrors\t%d
 nxdomains\t0
-noerrors\t%d
-servfails\t0
+other-rcode\t0
+queries\t%d
 recv-errors\t0
-tcp-drops\t0
+refuseds\t0
 responses\t%d
-other-rcode\t0
 send-errors\t0
-queries\t%d
+servfails\t0
+tcp-drops\t0
 """ % (numberOfQueries, numberOfQueries, numberOfQueries))