Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

functional: make replace tests wait for N active units #21

Closed
wants to merge 12 commits into from

Conversation

dongsupark
Copy link

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().

This PR depends on coreos#1509
/cc @tixxdz

Djalal Harouni and others added 12 commits March 17, 2016 09:14
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().
@dongsupark
Copy link
Author

It's merged to coreos#1509 . Closing..

@dongsupark dongsupark closed this Mar 17, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant