From 39411b516d3e941fd115fe38dc05b88d16dcb223 Mon Sep 17 00:00:00 2001 From: Julius Volz Date: Sun, 17 Feb 2013 01:01:50 +0100 Subject: [PATCH] Add missing config test fixtures. --- config/config_test.go | 8 ++-- config/fixtures/bad_job_option.conf.input | 21 ++++++++++ config/fixtures/empty.conf.input | 0 config/fixtures/minimal.conf.input | 21 ++++++++++ config/fixtures/sample.conf.input | 51 +++++++++++++++++++++++ 5 files changed, 97 insertions(+), 4 deletions(-) create mode 100644 config/fixtures/bad_job_option.conf.input create mode 100644 config/fixtures/empty.conf.input create mode 100644 config/fixtures/minimal.conf.input create mode 100644 config/fixtures/sample.conf.input diff --git a/config/config_test.go b/config/config_test.go index 477ae067f..da70ff732 100644 --- a/config/config_test.go +++ b/config/config_test.go @@ -30,16 +30,16 @@ var configTests = []struct { errContains string }{ { - inputFile: "minimal.conf", + inputFile: "minimal.conf.input", printedFile: "minimal.conf.printed", }, { - inputFile: "sample.conf", + inputFile: "sample.conf.input", printedFile: "sample.conf.printed", }, { // TODO: Options that are not provided should be set to sane defaults or // create errors during config loading (as appropriate). Right now, these // options remain at their zero-values, which is probably not what we want. - inputFile: "empty.conf", + inputFile: "empty.conf.input", printedFile: "empty.conf.printed", }, // TODO: To enable testing of bad configs, we first need to change config @@ -47,7 +47,7 @@ var configTests = []struct { // configuration error should be passed back all the way to the caller. // //{ - // inputFile: "bad_job_option.conf", + // inputFile: "bad_job_option.conf.input", // shouldFail: true, // errContains: "Missing job name", //}, diff --git a/config/fixtures/bad_job_option.conf.input b/config/fixtures/bad_job_option.conf.input new file mode 100644 index 000000000..8914ed292 --- /dev/null +++ b/config/fixtures/bad_job_option.conf.input @@ -0,0 +1,21 @@ +global { + scrape_interval = "30s" + evaluation_interval = "30s" + labels { + monitor = "test" + } + rule_files = [ + "prometheus.rules" + ] +} + +job { + jobname = "prometheus" + scrape_interval = "15s" + + targets { + endpoints = [ + "http://localhost:9090/metrics.json" + ] + } +} diff --git a/config/fixtures/empty.conf.input b/config/fixtures/empty.conf.input new file mode 100644 index 000000000..e69de29bb diff --git a/config/fixtures/minimal.conf.input b/config/fixtures/minimal.conf.input new file mode 100644 index 000000000..41ed13c7a --- /dev/null +++ b/config/fixtures/minimal.conf.input @@ -0,0 +1,21 @@ +global { + scrape_interval = "30s" + evaluation_interval = "30s" + labels { + monitor = "test" + } + rule_files = [ + "prometheus.rules" + ] +} + +job { + name = "prometheus" + scrape_interval = "15s" + + targets { + endpoints = [ + "http://localhost:9090/metrics.json" + ] + } +} diff --git a/config/fixtures/sample.conf.input b/config/fixtures/sample.conf.input new file mode 100644 index 000000000..f8ece5cc7 --- /dev/null +++ b/config/fixtures/sample.conf.input @@ -0,0 +1,51 @@ +global { + scrape_interval = "30s" + evaluation_interval = "30s" + labels { + monitor = "test" + } + rule_files = [ + "prometheus.rules" + ] +} + +job { + name = "prometheus" + scrape_interval = "15s" + + targets { + endpoints = [ + "http://localhost:9090/metrics.json" + ] + labels { + group = "canary" + } + } +} + +job { + name = "random" + scrape_interval = "30s" + + targets { + endpoints = [ + "http://random.com:8080/metrics.json", + "http://random.com:8081/metrics.json", + "http://random.com:8082/metrics.json", + "http://random.com:8083/metrics.json", + "http://random.com:8084/metrics.json" + ] + labels { + group = "production" + } + } + targets { + endpoints = [ + "http://random.com:8085/metrics.json", + "http://random.com:8086/metrics.json" + ] + labels { + group = "canary" + } + } +}