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: add new tests TestUnit{Submit,Load,Start}Replace #20

Closed
wants to merge 17 commits into from

Conversation

dongsupark
Copy link

  • TestUnitSubmitReplace() tests whether a command "fleetctl submit --replace hello.service" works or not.
  • TestUnitLoadReplace() tests whether a command "fleetctl load --replace hello.service" works or not.
  • TestUnitStartReplace() tests whether a command "fleetctl start --replace hello.service" works or not.

This PR depends on #18.
/cc @tixxdz

Djalal Harouni and others added 14 commits March 8, 2016 12:09
Add isLocalUnitDifferent() and use it to check if the local unit differs
from the one in the registry. This function handles both old scenario
and the new one attended to replace units.
This is only for development purpose and debugging, all this will be
later removed or optimised.

Signed-off-by: Djalal Harouni <[email protected]>
Move MatchUnitFile() to unit package we will use it inside fleetd to
check for unit hash matching
Check if the new submited unit is a new version of an already submitted
unit.
This is a hack, we will have to improve it later.
This is just for debugging and dev purpose
The interface to create units and set the target state is the same, so
to differenciate between those two we check if the units have the same
name and the content of the passed unit is really there! if not we
assume that the caller wants to set the target state and if it's not the
case we also catch that by len(su.DesiredState) == 0 check
@dongsupark
Copy link
Author

All right. Jenkins job fails, because one of the new tests occasionally fails after running fleetctl destroy. I'm not sure why.

@dongsupark dongsupark force-pushed the dongsu/fleetctl-replace-unit-fxtests branch from 91fc9da to 9afffeb Compare March 16, 2016 09:26
@dongsupark
Copy link
Author

I fixed bugs in the functional tests. Used maxAttempts correctly, and fixed the logic error upon retrying fleetctl destroy.
Now functional tests are working, and Jenkins job succeeds.
Though I don't like this ugly code. I'm thinking about how to refactor it.

@dongsupark dongsupark force-pushed the dongsu/fleetctl-replace-unit-fxtests branch from 9afffeb to b1a716c Compare March 16, 2016 11:09
@dongsupark
Copy link
Author

Did refactoring for the entire patchset. Functional tests are working well too.
@tixxdz if you think it's ok, can you merge this to your tree, to create a PR to the upstream?

@tixxdz
Copy link

tixxdz commented Mar 16, 2016

@dongsupark ok just let me know when you add those "submit load and start many units" tests, I'll pull them on top. Thank you!

@dongsupark dongsupark force-pushed the dongsu/fleetctl-replace-unit-fxtests branch from b1a716c to 5625e22 Compare March 16, 2016 15:15
Dongsu Park added 3 commits March 16, 2016 16:57
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.
@dongsupark dongsupark force-pushed the dongsu/fleetctl-replace-unit-fxtests branch from 0755571 to 905adf5 Compare March 16, 2016 16:00
@dongsupark
Copy link
Author

Close in favor of coreos#1509

@dongsupark dongsupark closed this Mar 16, 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.

2 participants