From a609749989d4ea67354ac5a464ce42a7b807b869 Mon Sep 17 00:00:00 2001 From: Andrew N Golovkov Date: Tue, 16 Jan 2018 16:11:43 +0200 Subject: [PATCH] `status` and `uptime` params is calculated --- statuscake/resource_statuscaketest.go | 12 ++++-------- statuscake/resource_statuscaketest_test.go | 6 ------ 2 files changed, 4 insertions(+), 14 deletions(-) diff --git a/statuscake/resource_statuscaketest.go b/statuscake/resource_statuscaketest.go index 27cf9bf..50e16f9 100644 --- a/statuscake/resource_statuscaketest.go +++ b/statuscake/resource_statuscaketest.go @@ -88,12 +88,12 @@ func resourceStatusCakeTest() *schema.Resource { "status": { Type: schema.TypeString, - Optional: true, + Computed: true, }, "uptime": { Type: schema.TypeFloat, - Optional: true, + Computed: true, }, "node_locations": { @@ -240,6 +240,8 @@ func CreateTest(d *schema.ResourceData, meta interface{}) error { } d.Set("test_id", fmt.Sprintf("%d", response.TestID)) + d.Set("status", response.Status) + d.Set("uptime", fmt.Sprintf("%.3f", response.Uptime)) d.SetId(fmt.Sprintf("%d", response.TestID)) return ReadTest(d, meta) @@ -365,12 +367,6 @@ func getStatusCakeTestInput(d *schema.ResourceData) *statuscake.Test { if v, ok := d.GetOk("user_agent"); ok { test.UserAgent = v.(string) } - if v, ok := d.GetOk("status"); ok { - test.Status = v.(string) - } - if v, ok := d.GetOk("uptime"); ok { - test.Uptime = v.(float64) - } if v, ok := d.GetOk("node_locations"); ok { test.NodeLocations = v.([]string) } diff --git a/statuscake/resource_statuscaketest_test.go b/statuscake/resource_statuscaketest_test.go index b39d23c..99acd04 100644 --- a/statuscake/resource_statuscaketest_test.go +++ b/statuscake/resource_statuscaketest_test.go @@ -171,10 +171,6 @@ func testAccTestCheckAttributes(rn string, test *statuscake.Test) resource.TestC err = check(key, value, test.CustomHeader) case "user_agent": err = check(key, value, test.UserAgent) - case "status": - err = check(key, value, test.Status) - case "uptime": - err = check(key, value, strconv.FormatFloat(test.Uptime, 'f', -1, 64)) case "node_locations": for _, tv := range test.NodeLocations { err = check(key, value, tv) @@ -260,8 +256,6 @@ resource "statuscake_test" "google" { trigger_rate = 20 custom_header = "{ \"Content-Type\": \"application/x-www-form-urlencoded\" }" user_agent = "string9988" - status = "string22117" - uptime = 3498.27 node_locations = [ "string16045", "string19741", "string12122" ] ping_url = "string8410" basic_user = "string27052" -- 2.41.0