Skip to content
This repository has been archived by the owner on Jun 28, 2024. It is now read-only.

tests: Add initial swarm tests #199

Merged
merged 1 commit into from
Apr 12, 2018
Merged

Conversation

GabyCT
Copy link
Contributor

@GabyCT GabyCT commented Apr 3, 2018

This will enable basic swarm tests.

Fixes #198

Signed-off-by: Gabriela Cervantes [email protected]

if [ "$replicas_running" -ge "$number_of_replicas" ]; then
break;
fi
sleep
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

missing operand

if [ "$replicas_running" -ge "$number_of_replicas" ]; then
break;
fi
sleep
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

missing value on sleep?

teardown() {
docker service remove "${SERVICE_NAME}"
docker swarm leave --force
check_processes ${SHIM_PATH}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should we also check for qemu and proxy processes?

--name "${SERVICE_NAME}" --replicas $number_of_replicas \
--publish 8080:80 "${nginx_image}" sh -c "$nginx_command"
running_regex='Running\s+\d+\s(seconds|minutes)\s+ago'
for i in $(seq "$timeout") ; do
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you should check the $i value inside the loop to see if we have reached the timeout and if so, return 1?

running_regex='Running\s+\d+\s(seconds|minutes)\s+ago'
for i in $(seq "$timeout") ; do
docker service ls --filter name="$SERVICE_NAME"
replicas_running=$(docker service ps "$SERVICE_NAME" | grep -P "${running_regex}" | wc -l)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you can use grep -c -P "${running_regex}" and remove wc -l

@GabyCT GabyCT force-pushed the topic/addswarm branch 2 times, most recently from 76c82d4 to 2ba737e Compare April 4, 2018 14:59
@GabyCT
Copy link
Contributor Author

GabyCT commented Apr 4, 2018

@chavafg the ci is failing with the following error .ci/teardown.sh "$WORKSPACE"
[kata-containers-tests-ubuntu-16-04-PR] $ /bin/bash /tmp/jenkins2389151152929419399.sh
sudo: kata-collect-data.sh: command not found
~/jenkins_slave/workspace/kata-containers-tests-ubuntu-16-04-PR ~/jenkins_slave/workspace/kata-containers-tests-ubuntu-16-04-PR/go/src/github.com/kata-containers/tests
gzip: kata-collect-data_*: No such file or directory

Any idea?

@jodh-intel
Copy link
Contributor

@GabyCT - I think this is due to #194. I'll raise a PR to resolve that now...

@GabyCT
Copy link
Contributor Author

GabyCT commented Apr 4, 2018

@jodh-intel thanks :)

@chavafg
Copy link
Contributor

chavafg commented Apr 4, 2018

I think that is not the root cause, above you can see:

~/jenkins_slave/workspace/kata-containers-tests-ubuntu-16-04-PR/go/src/github.com/kata-containers/osbuilder/image-builder ~/jenkins_slave/workspace/kata-containers-tests-ubuntu-16-04-PR/go/src/github.com/kata-containers/tests
ERROR: ../rootfs-builder/rootfs is not a directory
Build step 'Execute shell' marked build as failure

@chavafg
Copy link
Contributor

chavafg commented Apr 4, 2018

maybe because of: kata-containers/osbuilder#63 ?

@jodh-intel
Copy link
Contributor

Yes - that does look like an issue. @erick0z - could you take a look?

@chavafg
Copy link
Contributor

chavafg commented Apr 4, 2018

testing locally, the old rootfs directory is now called rootfs-Clear, because we are using clearlinux as the OS_BUILDER_DISTRO:

OSBUILDER_DISTRO=${OSBUILDER_DISTRO:-clearlinux}  
~/go/src/github.com/kata-containers/osbuilder/image-builder ~/go/src/github.com/kata-containers/tests
+ sudo -E AGENT_INIT=no USE_DOCKER=true ./image_builder.sh ../rootfs-builder/rootfs
ERROR: ../rootfs-builder/rootfs is not a directory

So I can change the name of the directory, but as we will test more distros in the future I am not sure what will be the best option here.
Maybe the directory should be called rootfs-clearlinux instead of rootfs-Clear?

cc @erick0z, @jcvenegas @jodh-intel @devimc

@erick0z
Copy link

erick0z commented Apr 4, 2018

@chavafg @jodh-intel Let me take a look!

@jodh-intel
Copy link
Contributor

Good catch @chavafg!

Now that the mega PR in osbuilder has landed, it looks like we can change the rootfs directory name by just setting ROOTFS_DIR=rootfs:

@chavafg
Copy link
Contributor

chavafg commented Apr 4, 2018

@jodh-intel, seems like it will need to be an absolute path, and after I changed to

export ROOTFS_DIR="${GOPATH}/src/${osbuilder_repo}/rootfs-builder/rootfs"

I am still getting the error. Seems like the rootfs directory is not being populated.

@erick0z
Copy link

erick0z commented Apr 4, 2018

@chavafg The latest changes introduced to the osbuilder repo changes the resulting rootfs directory name, so the ../rootfs-builder/rootfs directory won't exist anymore. It should exist, for instance: ../rootfs-builder/rootfs-Clear.

Have you tried the following?
sudo -E AGENT_INIT=no USE_DOCKER=true ./image_builder.sh ../rootfs-builder/rootfs-Clear

Other option is, when building the rootfs:
sudo -E PATH=$PATH DISTRO=clearlinux DISTRO_ROOTFS="${GOPATH}/src/${osbuilder_repo}/rootfs-builder/rootfs" make rootfs
This will populate the ../rootfs dir with a clearlinux rootfs

@chavafg
Copy link
Contributor

chavafg commented Apr 4, 2018

@GabyCT opened #212, which solve the issue, after it is merged, please rebase your branch

@GabyCT
Copy link
Contributor Author

GabyCT commented Apr 5, 2018

@jodh-intel thanks for the help and @chavafg thanks for solving the issue with the CI, the problem was solved

@GabyCT
Copy link
Contributor Author

GabyCT commented Apr 5, 2018

@chavafg changes applied

This will enable basic swarm tests.

Fixes kata-containers#198

Signed-off-by: Gabriela Cervantes <[email protected]>
if [ "$replicas_running" -ge "$number_of_replicas" ]; then
break
fi
sleep 1
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can you add below something like:
[ "$i" == "$timeout" ] && return 1
which would mean that we are reaching the timeout and no replicas were running, then we need to fail.

@GabyCT GabyCT force-pushed the topic/addswarm branch 3 times, most recently from 74fec7c to 3cef92a Compare April 9, 2018 18:49
@GabyCT
Copy link
Contributor Author

GabyCT commented Apr 10, 2018

@chavafg changes applied

Copy link

@devimc devimc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@devimc devimc merged commit 06261bc into kata-containers:master Apr 12, 2018
@GabyCT GabyCT deleted the topic/addswarm branch July 29, 2021 21:49
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants