nicgrayson / terraform-provider-marathon

a Terraform (http://terraform.io) provider for interacting with Marathon (https://mesosphere.github.io/marathon/)
MIT License
59 stars 24 forks source link

port_mapping.name, port_definition.[name|lables], health_check.port a… #65

Open cihangirbesiktas opened 7 years ago

cihangirbesiktas commented 7 years ago

…nd volume.external are added

cihangirbesiktas commented 7 years ago

I try to resolve this test case, but the test is posting a json definition with container.volumes.volume.external = {} when there is no external in the definition that causes marathon api to produce error. The code is running in our environment without an error.

luisdavim commented 7 years ago

The test that @cihangirbesiktas mentioned is now fixed but we have another problem:

* marathon_app.app-create-example: Marathon API error: Object is not valid (path: '/upgradeStrategy/maximumOverCapacity' errors: got 0.3, expected 0.0; path: '/container/volumes(1)' errors: Feature external_volumes is not enabled. Enable with --enable_features external_volumes); path: '/container/portMappings(1)/name' errors: must fully match regular expression '^[a-z0-9-]+$')

The instance of marathon that we are using doesn't have --enable_features external_volumes @nicgrayson any ideas on how to fix this?

luisdavim commented 7 years ago

Thanks @calvernaz

calvernaz commented 7 years ago

The failing test has wrong expectations but I'm not sure where to fix it. The expected value is wrong.

cihangirbesiktas commented 7 years ago

--- FAIL: TestAccMarathonApp_basic (5.76s) testing.go:268: Step 0 error: Error applying: 1 error(s) occurred:

    * marathon_app.app-create-example: 1 error(s) occurred:

    * marathon_app.app-create-example: Marathon API error: Object is not valid (path: '/upgradeStrategy/maximumOverCapacity' errors: got 0.3, expected 0.0)

I did not change upgradeStrategy but getting this error, it seems the test env is not set up properly, I could not find out the problem but it would be better if it is fixed.

kamsz commented 7 years ago

@cihangirbesiktas I believe this happens because you've external volume attached in example.tf. In such case, upgrade strategy has to be set to 0, because Marathon cannot start an additional task (since volume can be mounted to only one task).

cihangirbesiktas commented 7 years ago

@kamsz but when I set the maximum over capacity to 0.0, I got the following error:

--- FAIL: TestAccMarathonApp_basic (5.05s) testing.go:268: Step 0 error: Error applying: 1 error(s) occurred:

            * marathon_app.app-create-example: 1 error(s) occurred:

            * marathon_app.app-create-example: Marathon API error: Object is not valid (path: '/upgradeStrategy/maximumOverCapacity' errors: got 1.0, expected 0.0)
luisdavim commented 7 years ago

maybe @nicgrayson could give us a hand here?

cihangirbesiktas commented 7 years ago

I found out that schema.ResourceData.GetOk function returns false when the value of a key is zero, but we need the zero value in /upgradeStrategy/maximumOverCapacity. There is another function schema.ResourceData.GetOkExists which returns true regardless of zero value, but it is in the latest repo of github.com/hashicorp/terraform/helper/schema. Could @nicgrayson update the repos?