Skip to content
This repository has been archived by the owner on Jun 30, 2018. It is now read-only.

Commit

Permalink
add retry_on_failure to environment
Browse files Browse the repository at this point in the history
  • Loading branch information
philwhiteuk committed Nov 16, 2017
1 parent 41afe4d commit dfc0894
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 1 deletion.
12 changes: 11 additions & 1 deletion plugin/providers/runscope/resource_runscope_environment.go
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,10 @@ func resourceRunscopeEnvironment() *schema.Resource {
},
Optional: true,
},
"retry_on_failure": &schema.Schema{
Type: schema.TypeBool,
Optional: true,
},
},
}
}
Expand Down Expand Up @@ -158,6 +162,7 @@ func resourceEnvironmentRead(d *schema.ResourceData, meta interface{}) error {
d.Set("preserve_cookies", environment.PreserveCookies)
d.Set("initial_variables", environment.InitialVariables)
d.Set("integrations", readIntegrations(environment.Integrations))
d.Set("retry_on_failure", environment.RetryOnFailure)
return nil
}

Expand All @@ -174,7 +179,8 @@ func resourceEnvironmentUpdate(d *schema.ResourceData, meta interface{}) error {
d.HasChange("initial_variables") ||
d.HasChange("integrations") ||
d.HasChange("regions") ||
d.HasChange("remote_agents") {
d.HasChange("remote_agents") ||
d.HasChange("retry_on_failure") {
client := meta.(*runscope.Client)
bucketId := d.Get("bucket_id").(string)
if testId, ok := d.GetOk("test_id"); ok {
Expand Down Expand Up @@ -294,6 +300,10 @@ func createEnvironmentFromResourceData(d *schema.ResourceData) (*runscope.Enviro
environment.RemoteAgents = remote_agents
}

if attr, ok := d.GetOk("retry_on_failure"); ok {
environment.RetryOnFailure = attr.(bool)
}

return environment, nil
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,10 @@ func testAccCheckEnvironmentExists(n string) resource.TestCheckFunc {
return fmt.Errorf("Expected %s, actual %s", "eu1", environment.Regions[1])
}

if !foundRecord.RetryOnFailure {
return fmt.Errorf("Expected retry_on_failure to be set to true")
}

return nil
}
}
Expand Down Expand Up @@ -138,6 +142,8 @@ resource "runscope_environment" "environment" {
uuid = "arbitrary-string"
}
]
retry_on_failure = true
}
resource "runscope_test" "test" {
Expand Down

0 comments on commit dfc0894

Please sign in to comment.