HomeMesosphereNo notifications. 4 unresolved issues.

unit tests (and fixes) for networking migration
ClosedAll Users

Authored by jdef on Mar 28 2017, 10:37 PM.

Diff Detail

Repository
rMARATHON marathon
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.
There are a very large number of changes, so older changes are hidden. Show Older Changes
jdef planned changes to this revision.Mar 28 2017, 10:37 PM

Still some additional tests to write, pushing this up as a PREVIEW

jdef retitled this revision from unit tests (and fixes) for networking migration to PREVIEW: unit tests (and fixes) for networking migration.
jdef updated this revision to Diff 2424.Mar 28 2017, 11:10 PM

rebase to master

jenkins requested changes to this revision.Mar 28 2017, 11:20 PM
This revision now requires changes to proceed.Mar 28 2017, 11:20 PM
jdef planned changes to this revision.Mar 28 2017, 11:39 PM

Not sure what Jenkins is complaining about. But I've got more changes coming anyway...

jdef updated this revision to Diff 2429.Mar 29 2017, 3:30 AM
jdef retitled this revision from PREVIEW: unit tests (and fixes) for networking migration to unit tests (and fixes) for networking migration.Mar 29 2017, 3:31 AM
jenkins requested changes to this revision.Mar 29 2017, 3:31 AM
This revision now requires changes to proceed.Mar 29 2017, 3:31 AM
jenkins accepted this revision.Mar 29 2017, 4:01 AM

Ship it!

This revision is now accepted and ready to land.Mar 29 2017, 4:01 AM
aquamatthias requested changes to this revision.Mar 29 2017, 12:49 PM

I imported a state that is runnable with 1.4, applied your patch to master and started this version.
The migration failed with:

Caused by: mesosphere.marathon.ValidationFailedException: Validation failed: Failure(Set(GroupViolation(Set(MON_GROUP, framework-id, SERVERPORT, FORWARDHOST, MON_APP, id, MON_CONTACT, SERVICENAME, MON_PIPE_ID, dns-proxy-pool, FORWARDPORT, EXTADDR, transparent, EXTNETNAME, ETCDENDPOINT, IO, ext-dns-server, LISTENPORT),contains elements, which are not valid.,Some(env),Set(GroupViolation(ext-dns-server,not valid,Some((15)),Set(RuleViolation(ext-dns-server,must contain only alphanumeric chars or underscore, and must not begin with a number,Some(value)))), GroupViolation(dns-proxy-pool,not valid,Some((12)),Set(RuleViolation(dns-proxy-pool,must contain only alphanumeric chars or underscore, and must not begin with a number,Some(value)))), GroupViolation(framework-id,not valid,Some((6)),Set(RuleViolation(framework-id,must contain only alphanumeric chars or underscore, and must not begin with a number,Some(value))))))))

You can do the same by

src/main/scala/mesosphere/marathon/raml/AppConversion.scala
351

If this is specific to proto handling, should this code be part of AppDefinition.fromProto?

src/main/scala/mesosphere/marathon/raml/ContainerConversion.scala
199

The idea with obsolete was: it is only used in Migration code. Why do we need this here?

This revision now requires changes to proceed.Mar 29 2017, 12:49 PM
jdef marked 2 inline comments as done.Mar 29 2017, 6:45 PM
jdef added inline comments.
src/main/scala/mesosphere/marathon/raml/AppConversion.scala
351

no because AppDefinition.fromProto converts from protobuf-to-model. This code converts from protobuf-to-RAML -- different semantics.

src/main/scala/mesosphere/marathon/raml/ContainerConversion.scala
199

because the migration code leverages protobuf-to-RAML conversions for the migration. I added the conversion funcs to our existing xxxConversion classes.

jdef marked 2 inline comments as done.Mar 29 2017, 10:19 PM

looks like the app has environment variable names that contain hyphens. how did we ever get here?

jdef added a comment.Mar 29 2017, 10:38 PM

D201 introduced stronger environment variable name validation. model validation is pretty lax for envvar names: https://github.com/mesosphere/marathon/blob/releases/1.4/src/main/scala/mesosphere/marathon/state/EnvVarValue.scala#L56

jdef added a comment.Mar 30 2017, 12:23 AM
[info] Caused by: mesosphere.marathon.ValidationFailedException: Validation failed: Failure(Set(RuleViolation(List(hostname, CLUSTER),Missing value,Some(constraints))))
[info]  at mesosphere.marathon.api.v2.Validation$class.validateOrThrow(Validation.scala:23)
[info]  at mesosphere.marathon.api.v2.Validation$.validateOrThrow(Validation.scala:304)
[info]  at mesosphere.marathon.api.v2.AppsResource$$anonfun$appNormalization$1.apply(AppsResource.scala:409)
[info]  at mesosphere.marathon.api.v2.AppsResource$$anonfun$appNormalization$1.apply(AppsResource.scala:406)
[info]  at mesosphere.marathon.Normalization$$anon$1.normalized(Normalization.scala:15)
[info]  at mesosphere.marathon.Normalization$Normalized$.normalize$extension(Normalization.scala:11)
[info]  at mesosphere.marathon.storage.migration.MigrationTo1_5$$anonfun$migrateServiceFlow$1.apply(MigrationTo1_5.scala:113)
[info]  at mesosphere.marathon.storage.migration.MigrationTo1_5$$anonfun$migrateServiceFlow$1.apply(MigrationTo1_5.scala:110)
jdef planned changes to this revision.Mar 30 2017, 12:23 AM
jdef updated this revision to Diff 2463.Mar 31 2017, 5:50 PM
  • rMARATHON0a64b1f84c14 sanity check: precise unit tests for envvar conversion, relocate envvar proto-to-RAML conversion
  • rMARATHON08a79d58d722 app envvar names should not use strict name validation to avoid API compat breakage
  • rebase to master
jdef added a comment.Mar 31 2017, 5:52 PM

@aquamatthias your concerns have been addressed. migration of the exported ZK blob now completes successfully

jenkins requested changes to this revision.Mar 31 2017, 5:55 PM
This revision now requires changes to proceed.Mar 31 2017, 5:55 PM
jenkins accepted this revision.Mar 31 2017, 6:27 PM

Ship it!

jasongilanfarr added inline comments.
src/main/scala/mesosphere/marathon/raml/AppConversion.scala
351

Should we have a Boolean to indicate whether it's empty or unset?

355

all the more reason to move to Json in storage soon

src/main/scala/mesosphere/marathon/storage/migration/MigrationTo1_5.scala
50

Should we validate too?

jdef added inline comments.Mar 31 2017, 6:44 PM
src/main/scala/mesosphere/marathon/raml/AppConversion.scala
351

there's no need. the state model doesn't define ports (definitions or mappings) wrapped in Option. RAML does, and that's where the complication comes in

src/main/scala/mesosphere/marathon/storage/migration/MigrationTo1_5.scala
50

validation is baked into the AppsResource normalizer; no additional steps needed here

aquamatthias requested changes to this revision.Apr 3 2017, 10:58 AM

I applied the migration to the production zk state. The migration now runs successfully - great!

Have you added a test case for all scenarios that failed before?
So we can make sure, we do not run again into this situation?

During the migration, laxer validations are applied.
This leads to a situation, where no change can be applied after the migration, since the validation on the root group fails with:

{
    "details": [
        {
            "errors": [
                "Missing value"
            ],
            "path": "/groups(0)/groups(2)/apps(37)/constraints"
        },
        {
            "errors": [
                "Missing value"
            ],
            "path": "/groups(0)/groups(2)/apps(4)/constraints"
        },
        {
            "errors": [
                "Missing value"
            ],
            "path": "/groups(0)/groups(2)/apps(36)/constraints"
        },
        {
            "errors": [
                "Missing value"
            ],
            "path": "/groups(0)/groups(2)/apps(0)/constraints"
        }
    ],
    "message": "Object is not valid"
}
aquamatthias added inline comments.Apr 3 2017, 11:17 AM
src/main/scala/mesosphere/marathon/api/v2/validation/EnvVarValidation.scala
23

This turns env var name validation off for apps.
I tried to add an env var like this:

"env": {
  "&&$G$ ^^^ kjshg dfg dfjkhgdfk g! doo": "marathon"
}

which should not have been accepted, but passes validation.

src/main/scala/mesosphere/marathon/raml/ContainerConversion.scala
199

Any suggestion to separate the migration path from the standard code path?
Or is it simply not obsolete?

src/main/scala/mesosphere/marathon/storage/migration/MigrationTo1_5.scala
85

Please add a short explanation, why current root must be last.

jdef planned changes to this revision.Apr 3 2017, 3:11 PM
jdef marked an inline comment as done.

suspect that constraint validation is failing because the recent constraint "fixes" that landed on master should have removed the largely redundant (but incorrect) validation func in AppDefinition. will create a separate diff for that and rebase this once that lands.

src/main/scala/mesosphere/marathon/api/v2/validation/EnvVarValidation.scala
23

D201 added a regression that invalidated names that were considered valid prior to D201. changes here fix that.

src/main/scala/mesosphere/marathon/raml/ContainerConversion.scala
199

I thought it would be pretty consistent to keep all the RAML conversion code in the same package. I could see, perhaps, segregating the protobuf-to-RAML code into separate conversion classes .. but then I think that complicates maintenance efforts - from a maintenance perspective I'd rather have everything in the same file.

do you have any suggestions?

we name proto fields OBSOLETE when they've been deprecated and no longer used for new items written to storage. according to that rule, I've named the fields appropriately

jdef updated this revision to Diff 2477.Apr 3 2017, 6:43 PM
jdef marked an inline comment as done.
jenkins requested changes to this revision.Apr 3 2017, 6:43 PM
This revision now requires changes to proceed.Apr 3 2017, 6:43 PM
jdef updated this revision to Diff 2478.Apr 3 2017, 6:47 PM

rebase to master

jenkins requested changes to this revision.Apr 3 2017, 6:54 PM
This revision now requires changes to proceed.Apr 3 2017, 6:54 PM
jenkins accepted this revision.Apr 3 2017, 7:14 PM

Thanks.

jenkins requested changes to this revision.Apr 3 2017, 8:50 PM
jenkins accepted this revision.Apr 3 2017, 9:55 PM

Ship it!

aquamatthias accepted this revision.Apr 4 2017, 6:03 PM

Thanks!

src/test/scala/mesosphere/mesos/protos/ImplicitsSpec.scala
6

Nit: please use double package notation. You should not need this import then.

This revision is now accepted and ready to land.Apr 4 2017, 6:03 PM
jdef added inline comments.Apr 4 2017, 7:07 PM
src/test/scala/mesosphere/mesos/protos/ImplicitsSpec.scala
6

double package only applies for mesosphere.marathon packages

This revision was automatically updated to reflect the committed changes.