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

Add scripts for e2e test on psi #4658

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
c9e4485
add scripts for e2e test on psi
anandrkskd Apr 26, 2021
8419e55
testing only e2e images
anandrkskd Apr 26, 2021
dc18db9
testing only e2e images
anandrkskd Apr 26, 2021
3694aad
testing only e2e images
anandrkskd Apr 26, 2021
0f3f900
testing inti-devfile tests
anandrkskd Apr 26, 2021
8eb7860
testing intiegration tests
anandrkskd Apr 28, 2021
954ef1f
testing operatorhub tests
anandrkskd Apr 29, 2021
265f027
update test script for mac
anandrkskd Apr 30, 2021
2088dab
fixing test on windows
anandrkskd May 4, 2021
a4b1d5f
fixing test on mac tests
anandrkskd May 5, 2021
3607f07
rebase
anandrkskd May 5, 2021
afeb544
fixing test on mac tests
anandrkskd May 5, 2021
ee995ba
test operatorhub and e2e
anandrkskd May 5, 2021
4c0172f
test e2e
anandrkskd May 6, 2021
4ae7a5a
fix e2e on mac
anandrkskd May 6, 2021
236f5f6
oc fix
anandrkskd May 6, 2021
ed46a53
Merge branch 'main' of https://github.com/openshift/odo into automate…
anandrkskd May 7, 2021
704508f
Merge branch 'automate-psi-ci-e2e' of https://github.com/anandrkskd/o…
anandrkskd May 7, 2021
696690d
Merge branch 'main' of https://github.com/openshift/odo into automate…
anandrkskd May 10, 2021
0f6644f
fix oc and revert devfile test
anandrkskd May 10, 2021
92c5621
fix testcase
anandrkskd May 17, 2021
f4dcd8d
fix testcase
anandrkskd May 17, 2021
94dbba9
rebase- Merge branch 'main' of https://github.com/openshift/odo into …
anandrkskd May 18, 2021
b8a840d
increase build timeout
anandrkskd May 20, 2021
9e02cc8
test operator hub
anandrkskd May 20, 2021
bbb2ad2
add oc describe and oc get for debug
anandrkskd May 24, 2021
5e38362
for debug update
anandrkskd May 24, 2021
fe8a053
removing integration-devfile tests
anandrkskd May 25, 2021
72f9743
removing integration test
anandrkskd May 25, 2021
2a7df6f
fixing script
anandrkskd May 25, 2021
117c6c0
Merge branch 'main' of https://github.com/openshift/odo into automate…
anandrkskd Jun 1, 2021
73969aa
Merge branch 'main' of https://github.com/openshift/odo into automate…
anandrkskd Jun 2, 2021
7d645c9
update debug statement
anandrkskd Jun 2, 2021
9a9bbda
Merge branch 'main' of https://github.com/openshift/odo into automate…
anandrkskd Jun 11, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions scripts/openshiftci-e2e-4x-psi-tests_win_mac.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
#!/bin/sh

case $1 in

win)
export SENDQUEUE=amqp.ci.queue.win.e2e.send
export SENDTOPIC=amqp.ci.topic.win.e2e.send
export JOB_NAME=odo-windows-e2e-pr-build
export SENDEXCHANGE=amqp.ci.exchange.win.e2e.send
;;

mac)
export SENDQUEUE=amqp.ci.queue.mac.e2e.send
export SENDTOPIC=amqp.ci.topic.mac.e2e.send
export JOB_NAME=odo-mac-e2e-pr-build
export SENDEXCHANGE=amqp.ci.exchange.mac.e2e.send
;;
esac

. scripts/openshiftci-e2e-4x-psi-tests.sh
92 changes: 92 additions & 0 deletions scripts/run_script_e2e.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
#!/usr/bin/env bash

shout() {
set +x
echo -e "\n!!!!!!!!!!!!!!!!!!!!\n${1}\n!!!!!!!!!!!!!!!!!!!!\n"
set -x
}

# Prep for integration/e2e
shout "Building odo binaries"
make bin

# copy built odo to GOBIN
cp -avf ./odo $GOBIN_TEMP/
shout "getting ginkgo"
make goget-ginkgo

# Integration tests
shout "Testing against 4x cluster"

shout "Logging into 4x cluster for some setup (logs hidden)"
set +x
oc login -u kubeadmin -p ${OCP4X_KUBEADMIN_PASSWORD} --insecure-skip-tls-verify ${OCP4X_API_URL}
set -x

shout "Doing some presetup"

# Delete any projects with SCRIPT_IDENTITY PREFIX. This is GC from previous runs which fail before end of script cleanup
for i in $(oc projects -q); do
if [[ $i == "${SCRIPT_IDENTITY}"* ]]; then
oc delete project $i
fi
done

# Generate random project names to some tests
export REDHAT_OPENJDK11_RHEL8_PROJECT="${SCRIPT_IDENTITY}$(cat /dev/urandom | tr -dc 'a-z0-9' | fold -w 4 | head -n 1)"
export REDHAT_OPENJDK11_UBI8_PROJECT="${SCRIPT_IDENTITY}$(cat /dev/urandom | tr -dc 'a-z0-9' | fold -w 4 | head -n 1)"
export REDHAT_NODEJS12_RHEL7_PROJECT="${SCRIPT_IDENTITY}$(cat /dev/urandom | tr -dc 'a-z0-9' | fold -w 4 | head -n 1)"
export REDHAT_NODEJS12_UBI8_PROJECT="${SCRIPT_IDENTITY}$(cat /dev/urandom | tr -dc 'a-z0-9' | fold -w 4 | head -n 1)"
export REDHAT_NODEJS14_UBI8_PROJECT="${SCRIPT_IDENTITY}$(cat /dev/urandom | tr -dc 'a-z0-9' | fold -w 4 | head -n 1)"

# Create the namespace for e2e image test apply pull secret to the namespace
for i in `echo "$REDHAT_OPENJDK11_RHEL8_PROJECT $REDHAT_NODEJS12_RHEL7_PROJECT $REDHAT_NODEJS12_UBI8_PROJECT $REDHAT_OPENJDK11_UBI8_PROJECT $REDHAT_NODEJS14_UBI8_PROJECT"`; do
# create the namespace
oc new-project $i
# Applying pull secret to the namespace which will be used for pulling images from authenticated registry
oc get secret pull-secret -n openshift-config -o yaml | sed "s/openshift-config/$i/g" | oc apply -f -
# Let developer user have access to the project
oc adm policy add-role-to-user edit developer
done

shout "Logging into 4x cluster as developer (logs hidden)"
set +x
oc login -u developer -p ${OCP4X_DEVELOPER_PASSWORD} --insecure-skip-tls-verify ${OCP4X_API_URL}
set -x

# # Integration tests
#shout "Running integration Tests"
make test-operator-hub || error=true
#remove comments from test-integration & test-integration-devfile once #4606 https://github.com/openshift/odo/issues/4606 is resolved
#make test-integration || error=true
#make test-integration-devfile || error=true
Copy link
Contributor

Choose a reason for hiding this comment

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

why not run integration-devfile instead of each test separately?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

we are facing issues in which odo push is failing, this is mostly failing on integration,integration-devfile tests. so for now we are just testing those parts that doesn't require odo push in integration, integration-devfile suites.

make test-cmd-devfile-catalog || error=true
make test-cmd-devfile-exec || error=true
make test-cmd-devfile-registry || error=true
make test-cmd-login-logout || error=true
make test-cmd-project || error=true


# E2e tests
shout "Running e2e tests"
make test-e2e-all || error=true
# Fail the build if there is any error while test execution
if [ $error ]; then
exit -1
fi

shout "cleaning up post tests"
shout "Logging into 4x cluster for cleanup (logs hidden)"
set +x
oc login -u kubeadmin -p ${OCP4X_KUBEADMIN_PASSWORD} --insecure-skip-tls-verify ${OCP4X_API_URL}
set -x

shout "Cleaning up some leftover projects"

set +x
for i in $(oc projects -q); do
if [[ $i == "${SCRIPT_IDENTITY}"* ]]; then
oc delete project $i
fi
done
set -x
59 changes: 59 additions & 0 deletions scripts/setup_script_e2e.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
#!/usr/bin/env bash

shout() {
set +x
echo -e "\n!!!!!!!!!!!!!!!!!!!!\n${1}\n!!!!!!!!!!!!!!!!!!!!\n"
set -x
}

set -ex

shout "Setting up some stuff"

# Create a bin directory whereever script runs. This will be where all binaries that need to be in PATH will reside.
mkdir bin artifacts
# Change the default location of go's bin directory (without affecting GOPATH). This is where compiled binaries will end up by default
# for eg go get ginkgo later on will produce ginkgo binary in GOBIN
export GOBIN="`pwd`/bin"
export GOBIN_TEMP=$GOBIN
# Set kubeconfig to current dir. This ensures no clashes with other test runs
export KUBECONFIG="`pwd`/config"
export ARTIFACT_DIR=${ARTIFACT_DIR:-"`pwd`/artifacts"}
export CUSTOM_HOMEDIR=$ARTIFACT_DIR
export WORKDIR=${WORKDIR:-"`pwd`"}
export GOCACHE=`pwd`/.gocache && mkdir $GOCACHE

# This si one of the variables injected by ci-firewall. Its purpose is to allow scripts to handle uniqueness as needed
SCRIPT_IDENTITY=${SCRIPT_IDENTITY:-"def-id"}
export SKIP_USER_LOGIN_TESTS="true"

shout "Getting oc binary"
if [[ $BASE_OS == "linux" ]]; then
set +x
curl --connect-timeout 150 --max-time 2048 -k ${OCP4X_DOWNLOAD_URL}/${ARCH}/${BASE_OS}/oc.tar -o ./oc.tar
set -x
tar -C $GOBIN -xvf ./oc.tar && rm -rf ./oc.tar
else
set +x
curl --connect-timeout 210 --max-time 2048 -k ${OCP4X_DOWNLOAD_URL}/${ARCH}/${BASE_OS}/oc.zip -o ./oc.zip
set -x
if [[ $BASE_OS == "windows" ]]; then
GOBIN_TEMP=$GOBIN
GOBIN="$(cygpath -pw $GOBIN)"
CURRDIR="$(cygpath -pw $WORKDIR)"
GOCACHE="$(cygpath -pw $GOCACHE)"
powershell -Command "Expand-Archive -Path $CURRDIR\oc.zip -DestinationPath $GOBIN"
chmod +x $GOBIN_TEMP/*
fi
if [[ $BASE_OS == "mac" ]]; then
# Skiping download of oc binary for test due to bandwidth issue, binary from cluster is stored in ~/ocforodo dir in macmini
#unzip ./oc.zip -d ~/go/bin/ && chmod +x ~/go/bin/oc
unzip ./oc.zip -d $GOBIN && rm -rf ./oc.zip && chmod +x $GOBIN/oc
PATH="$PATH:/usr/local/bin:/usr/local/go/bin"
fi
fi

# Add GOBIN which is the bin dir we created earlier to PATH so any binaries there are automatically available in PATH
export PATH=$PATH:$GOBIN

#-----------------------------------------------------------------------------
1 change: 1 addition & 0 deletions tests/helper/helper_generic.go
Original file line number Diff line number Diff line change
Expand Up @@ -307,6 +307,7 @@ func CommonBeforeEach() CommonVar {

// CommonAfterEach is common function that cleans up after every test Spec (It)
func CommonAfterEach(commonVar CommonVar) {
CmdRunner("oc", "describe", "pods", "-n", commonVar.Project)
// delete the random project/namespace created in CommonBeforeEach
commonVar.CliRunner.DeleteNamespaceProject(commonVar.Project)

Expand Down
3 changes: 2 additions & 1 deletion tests/integration/cmd_push_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,8 @@ var _ = Describe("odo push command tests", func() {
// create a file and folder then push
err := os.MkdirAll(filepath.Join(commonVar.Context, "tests"), 0750)
Expect(err).To(BeNil())
_, err = os.Create(filepath.Join(commonVar.Context, "README.md"))
testFile, err := os.Create(filepath.Join(commonVar.Context, "README.md"))
testFile.Close()
Expect(err).To(BeNil())

helper.CmdShouldPass("odo", "push", "--context", commonVar.Context)
Expand Down
9 changes: 7 additions & 2 deletions tests/integration/component.go
Original file line number Diff line number Diff line change
Expand Up @@ -255,8 +255,13 @@ func componentTests(args ...string) {
oc.ImportJavaIS(commonVar.Project)
helper.CopyExample(filepath.Join("binary", "java", "openjdk"), commonVar.Context)
// Was failing due to https://github.com/openshift/odo/issues/1969
helper.CmdShouldPass("odo", append(args, "create", "--s2i", "java:8", "sb-jar-test", "--project",
commonVar.Project, "--binary", filepath.Join(commonVar.Context, "sb.jar"))...)
if runtime.GOOS == "darwin" {
helper.CmdShouldPass("odo", append(args, "create", "--s2i", "java:8", "sb-jar-test", "--project",
commonVar.Project, "--binary", filepath.Join("/private", commonVar.Context, "sb.jar"))...)
} else {
helper.CmdShouldPass("odo", append(args, "create", "--s2i", "java:8", "sb-jar-test", "--project",
commonVar.Project, "--binary", filepath.Join(commonVar.Context, "sb.jar"))...)
}
info := helper.LocalEnvInfo(commonVar.Context)
Expect(info.GetName(), "sb-jar-test")
})
Expand Down
3 changes: 2 additions & 1 deletion tests/integration/devfile/cmd_devfile_create_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ var _ = Describe("odo devfile create command tests", func() {
Context("When executing odo create with devfile component type argument and --context flag", func() {
var newContext, envFilePath string
JustBeforeEach(func() {
newContext = path.Join(commonVar.Context, "newContext")
newContext = filepath.Join(commonVar.Context, "newContext")
devfilePath = filepath.Join(newContext, devfile)
helper.MakeDir(newContext)
})
Expand Down Expand Up @@ -157,6 +157,7 @@ var _ = Describe("odo devfile create command tests", func() {
values := gjson.GetMany(output, "kind", "metadata.name", "status.state")
Expect(helper.GjsonMatcher(values, []string{"Component", "nodejs", "Unknown"})).To(Equal(true))

newKubeConfig.Close()
err = os.Remove(newKubeConfigPath)
Expect(err).To(BeNil())
})
Expand Down