-
Notifications
You must be signed in to change notification settings - Fork 48
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
Test replacement of one application with another #891
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
# Here we test two application configurations that cannot coexist at the same time. | ||
# First, we deploy application app1 into network with only one free IP address | ||
# and then try to deploy another application into the same network. The second | ||
# application should stay in the error state as long as the first app exist. | ||
# However, once the first application is deleted, the second application should be | ||
# automatically deployed and take the IP of the removed first app. | ||
# In the second part of the test we replace application with another within the same | ||
# config iteration. EVE should first remove the obsolete application before deploying | ||
# the new one, otherwise it will fail to allocate IP address (since only one IP address | ||
# is available at a time). | ||
|
||
[!exec:jq] stop | ||
[!exec:grep] stop | ||
[!exec:bash] stop | ||
[!exec:uuidgen] stop | ||
|
||
# Starting of reboot detector with a 1 reboot limit | ||
! test eden.reboot.test -test.v -timewait=0 -reboot=0 -count=1 & | ||
|
||
message 'Resetting of EVE' | ||
eden eve reset | ||
exec sleep 30 | ||
|
||
# Create network with only single IP address left for allocation for applications. | ||
# Note that one IP is used for the bridge. | ||
eden -t 1m network create 10.11.12.0/30 -n n1 | ||
test eden.network.test -test.v -timewait 10m ACTIVATED n1 | ||
|
||
# Deploy application that will use the only IP address available | ||
eden -t 1m pod deploy -n app1 -p 8027:80 docker://nginx --networks=n1 --memory 512MB | ||
test eden.app.test -test.v -timewait 10m RUNNING app1 | ||
|
||
# Try to deploy another application, but there is no free IP left. | ||
eden -t 1m pod deploy -n app2 -p 8028:80 docker://nginx --networks=n1 --memory 512MB | ||
exec -t 5m bash wait_for_app_error.sh app2 'no free IP addresses in DHCP range' | ||
|
||
# Now undeploy the first app and the second one should come up. | ||
eden pod delete app1 | ||
test eden.app.test -test.v -timewait 10m - app1 | ||
test eden.app.test -test.v -timewait 10m RUNNING app2 | ||
|
||
# Change the second app UUID which is effectively the same as replacing | ||
# one application with another in one config iteration. | ||
exec -t 5m bash change-app-uuid.sh app2 | ||
test eden.app.test -test.v -timewait 5m RUNNING app2 | ||
|
||
# Cleanup. | ||
eden pod delete app2 | ||
test eden.app.test -test.v -timewait 10m - app2 | ||
eden -t 1m network delete n1 | ||
test eden.network.test -test.v -timewait 2m - n1 | ||
|
||
-- wait_for_app_error.sh -- | ||
#!/bin/sh | ||
|
||
APP="$1" | ||
ERR="$2" | ||
|
||
EDEN={{EdenConfig "eden.root"}}/{{EdenConfig "eden.bin-dist"}}/{{EdenConfig "eden.eden-bin"}} | ||
until $EDEN pod ps | grep "^$APP" | grep "$ERR"; do sleep 3; done | ||
|
||
-- change-app-uuid.sh -- | ||
#!/bin/sh | ||
|
||
APP="$1" | ||
NEW_UUID="$(uuidgen)" | ||
|
||
EDEN={{EdenConfig "eden.root"}}/{{EdenConfig "eden.bin-dist"}}/{{EdenConfig "eden.eden-bin"}} | ||
$EDEN controller edge-node get-config --file device.cfg | ||
UUID=$(jq -r '.apps[] | select(.displayname == "'$APP'") | .uuidandversion.uuid' < device.cfg) | ||
sed -i "s/\"uuid\": \"$UUID\"/\"uuid\": \"$NEW_UUID\"/" device.cfg | ||
$EDEN controller edge-node set-config --file device.cfg | ||
while $EDEN pod ps | grep $UUID; do sleep 3; done |
This file contains 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
This file contains 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
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not a blocker, but just to mention: test located here will run only on EdenGCP workflow for now, as we have
{{ if or (eq $workflow "large") (eq $workflow "gcp") }}
above.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
and we need to add this tests to new workflows, because EVE is using them. I suggest to put this in user app
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I already put this to user-apps.tests.txt
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My bad, didn't see it :D
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@giggsoff I didn't realize that the test would be skipped in the old workflow, but since we are going to move to the new workflow soon, I'm going to keep it as it is.