From bc2bde6b20d0b6a7a0e1edd0b6a4e726c446d7c6 Mon Sep 17 00:00:00 2001 From: Mat Schaffer Date: Fri, 27 Jul 2018 17:17:26 +0900 Subject: Update test_tag handling to be a proper list of strings --- statuscake/resource_statuscaketest.go | 9 ++++++--- statuscake/resource_statuscaketest_test.go | 4 ++-- website/docs/r/test.html.markdown | 2 +- 3 files changed, 9 insertions(+), 6 deletions(-) diff --git a/statuscake/resource_statuscaketest.go b/statuscake/resource_statuscaketest.go index d7d3f36..866cdce 100644 --- a/statuscake/resource_statuscaketest.go +++ b/statuscake/resource_statuscaketest.go @@ -94,6 +94,7 @@ func resourceStatusCakeTest() *schema.Resource { Optional: true, Default: 5, }, + "custom_header": { Type: schema.TypeString, Optional: true, @@ -178,8 +179,10 @@ func resourceStatusCakeTest() *schema.Resource { }, "test_tags": { - Type: schema.TypeString, + Type: schema.TypeSet, + Elem: &schema.Schema{Type: schema.TypeString}, Optional: true, + Set: schema.HashString, }, "status_codes": { @@ -240,7 +243,7 @@ func CreateTest(d *schema.ResourceData, meta interface{}) error { FindString: d.Get("find_string").(string), DoNotFind: d.Get("do_not_find").(bool), RealBrowser: d.Get("real_browser").(int), - TestTags: d.Get("test_tags").(string), + TestTags: castSetToSliceStrings(d.Get("test_tags").(*schema.Set).List()), StatusCodes: d.Get("status_codes").(string), UseJar: d.Get("use_jar").(int), PostRaw: d.Get("post_raw").(string), @@ -417,7 +420,7 @@ func getStatusCakeTestInput(d *schema.ResourceData) *statuscake.Test { test.RealBrowser = v.(int) } if v, ok := d.GetOk("test_tags"); ok { - test.TestTags = v.(string) + test.TestTags = castSetToSliceStrings(v.(*schema.Set).List()) } if v, ok := d.GetOk("status_codes"); ok { test.StatusCodes = v.(string) diff --git a/statuscake/resource_statuscaketest_test.go b/statuscake/resource_statuscaketest_test.go index 8bcbb36..c10b5d3 100644 --- a/statuscake/resource_statuscaketest_test.go +++ b/statuscake/resource_statuscaketest_test.go @@ -91,7 +91,7 @@ func TestAccStatusCake_withUpdate(t *testing.T) { resource.TestCheckResourceAttr("statuscake_test.google", "find_string", "string15212"), resource.TestCheckResourceAttr("statuscake_test.google", "do_not_find", "false"), resource.TestCheckResourceAttr("statuscake_test.google", "real_browser", "1"), - resource.TestCheckResourceAttr("statuscake_test.google", "test_tags", "string8191"), + resource.TestCheckResourceAttr("statuscake_test.google", "test_tags.#", "1"), resource.TestCheckResourceAttr("statuscake_test.google", "status_codes", "string23065"), resource.TestCheckResourceAttr("statuscake_test.google", "use_jar", "1"), resource.TestCheckResourceAttr("statuscake_test.google", "post_raw", "string32096"), @@ -261,7 +261,7 @@ resource "statuscake_test" "google" { find_string = "string15212" do_not_find = false real_browser = 1 - test_tags = "string8191" + test_tags = ["string8191"] status_codes = "string23065" use_jar = 1 post_raw = "string32096" diff --git a/website/docs/r/test.html.markdown b/website/docs/r/test.html.markdown index b154773..45e904a 100644 --- a/website/docs/r/test.html.markdown +++ b/website/docs/r/test.html.markdown @@ -50,7 +50,7 @@ The following arguments are supported: * `find_string` - (Optional) A string that should either be found or not found. * `do_not_find` - (Optional) If the above string should be found to trigger a alert. 1 = will trigger if find_string found. * `real_browser` - (Optional) Use 1 to TURN OFF real browser testing. -* `test_tags` - (Optional) Tags should be seperated by a comma - no spacing between tags (this,is,a set,of,tags). +* `test_tags` - (Optional) Set test tags, must be array of strings. * `status_codes` - (Optional) Comma Seperated List of StatusCodes to Trigger Error on. Defaults are "204, 205, 206, 303, 400, 401, 403, 404, 405, 406, 408, 410, 413, 444, 429, 494, 495, 496, 499, 500, 501, 502, 503, 504, 505, 506, 507, 508, 509, 510, 511, 521, 522, 523, 524, 520, 598, 599". * `use_jar` - (Optional) Set to true to enable the Cookie Jar. Required for some redirects. Default is false. * `post_raw` - (Optional) Use to populate the RAW POST data field on the test. -- cgit v1.2.3