예제 #1
0
    def test_get_metrics_no_server(self, params=None):
        if not params:
            params = {"type": "metric",
                      "cluster": "East",
                      "bucket": "default"}
            expected = [{"name": "disk_write_queue", "collector": "ns_server"}]
        else:
            expected = [
                {"name": "disk_write_queue", "collector": "ns_server"},
                {"name": params["name"], "collector": params["collector"]}
            ]
        request = self.factory.get("/get_metrics", params)
        self.response = views.get_metrics(request)

        # Verify content
        self.assertEquals(sorted(self.response.content),
                          sorted(json.dumps(expected)))
예제 #2
0
    def test_get_metrics(self, params=None):
        if not params:
            params = {"cluster": "East",
                      "server": "ec2-54-242-160-13.compute-1.amazonaws.com",
                      "bucket": "default",
                      "collector": "ns_server"}
            expected = [{"name": "cache_miss", "collector": "ns_server"}]
        else:
            expected = [
                {"name": "cache_miss", "collector": "ns_server"},
                {"name": params["name"], "collector": params["collector"]}
            ]
        request = self.factory.get("/get_metrics", params)
        self.response = views.get_metrics(request)

        # Verify content
        self.assertEquals(sorted(self.response.content),
                          sorted(json.dumps(expected)))