@@ -20,31 +20,31 @@ import (
2020func TestConfig (t * testing.T ) {
2121 srv := httptest .NewServer (http .HandlerFunc (func (w http.ResponseWriter , r * http.Request ) {
2222 switch r .URL .Path {
23- case "/30s/api/v1/status/config" :
23+ case "/30s" + promapi . APIPathConfig :
2424 w .WriteHeader (200 )
2525 w .Header ().Set ("Content-Type" , "application/json" )
2626 _ , _ = w .Write ([]byte (`{"status":"success","data":{"yaml":"global:\n scrape_interval: 30s\n"}}` ))
27- case "/1m/api/v1/status/config" :
27+ case "/1m" + promapi . APIPathConfig :
2828 w .WriteHeader (200 )
2929 w .Header ().Set ("Content-Type" , "application/json" )
3030 _ , _ = w .Write ([]byte (`{"status":"success","data":{"yaml":"global:\n scrape_interval: 1m\n"}}` ))
31- case "/default/api/v1/status/config" :
31+ case "/default" + promapi . APIPathConfig :
3232 w .WriteHeader (200 )
3333 w .Header ().Set ("Content-Type" , "application/json" )
3434 _ , _ = w .Write ([]byte (`{"status":"success","data":{"yaml":"global:\n {}\n"}}` ))
35- case "/once/api/v1/status/config" :
35+ case "/once" + promapi . APIPathConfig :
3636 w .WriteHeader (200 )
3737 w .Header ().Set ("Content-Type" , "application/json" )
3838 _ , _ = w .Write ([]byte (`{"status":"success","data":{"yaml":"global:\n {}\n"}}` ))
39- case "/slow/api/v1/status/config" :
39+ case "/slow" + promapi . APIPathConfig :
4040 w .WriteHeader (200 )
4141 w .Header ().Set ("Content-Type" , "application/json" )
4242 time .Sleep (time .Second * 2 )
4343 _ , _ = w .Write ([]byte (`{"status":"success","data":{"yaml":"global:\n {}\n"}}` ))
44- case "/error/api/v1/status/config" :
44+ case "/error" + promapi . APIPathConfig :
4545 w .WriteHeader (500 )
4646 _ , _ = w .Write ([]byte ("fake error\n " ))
47- case "/badYaml/api/v1/status/config" :
47+ case "/badYaml" + promapi . APIPathConfig :
4848 w .WriteHeader (200 )
4949 w .Header ().Set ("Content-Type" , "application/json" )
5050 _ , _ = w .Write ([]byte (`{"status":"success","data":{"yaml":"invalid yaml"}}` ))
0 commit comments