functional: make replace tests wait for N active units#21
Closed
dongsupark wants to merge 12 commits intomasterfrom
Closed
functional: make replace tests wait for N active units#21dongsupark wants to merge 12 commits intomasterfrom
dongsupark wants to merge 12 commits intomasterfrom
Conversation
This patch adds some variables that will be used in the next patch to implement replace units feature. The replace flag and the current command that's being executed.
Add checkUnitCreation() to check if the unit should be created or not. This function handles the new replace logic. Add isLocalUnitDifferent() since we don't really want to warn if the unit do really differ in case "--replace" switch was set. At the same time factor out unit matching logic.
Just use isLocalUnitDifferent() instead of old warnOnDifferentLocalUnit()
Move MatchUnitFile() to unit package we will use it inside fleetd to check for unit matching.
If there is a unit with the same name, check if the content of both differ if so then we create a new one in the registry.
…ady exists Since we started to support replacing units and updating unit states, we instruct etcd driver to ignore job keys that already exists and just replace them.
Add new helpers copyFile(), genNewFleetService() & destroyUnitRetrying() to prepare the new functional tests for the replace options. copyFile() is a helper to copy one file to another. genNewFleetService() is a helper to replace a string with a new one. It's necessary for the next functional tests. destroyUnitRetrying() runs "fleetctl <cmd> --replace" repeatedly to ensure the unit is actually removed.
TestUnit{Submit,Load,Start}Replace() tests whether a command "fleetctl
{submit,load,start} --replace hello.service" works respectively.
As most of the test sequences are identical, the common part is split
into replaceUnitCommon().
For commands fleetctl {submit,load,start}, also test loading multiple
units at the same time, and replacing each of them one after another.
After "fleetctl start --replace", it should wait until expected number
of active units are available. So use waitForNActiveUnits() after
running list-units. However, for "fleetctl {load,submit} --replace",
it should expect 0 active units. To distinguish that, create a new
wrapper waitForActiveUnitsReplaceCmds().
Author
|
It's merged to coreos#1509 . Closing.. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
After
"fleetctl start --replace", it should wait until expected numberof active units are available. So use
waitForNActiveUnits()afterrunning list-units. However, for
"fleetctl {load,submit} --replace",it should expect 0 active units. To distinguish that, create a new
wrapper
waitForActiveUnitsReplaceCmds().This PR depends on coreos#1509
/cc @tixxdz