-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: rohan2794 <[email protected]>
- Loading branch information
Showing
13 changed files
with
214 additions
and
8 deletions.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
name: e2e tests | ||
on: | ||
pull_request: | ||
types: ['opened', 'edited', 'reopened', 'synchronize'] | ||
# Since the on property is required, using the workflow_dispatch event, | ||
# which allows you to manually trigger the workflow from the GitHub Actions interface. | ||
# on: | ||
# workflow_dispatch: | ||
|
||
jobs: | ||
lint: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: DeterminateSystems/nix-installer-action@v11 | ||
with: | ||
kvm: true | ||
- uses: DeterminateSystems/magic-nix-cache-action@v6 | ||
- name: Pre-populate nix-shell | ||
run: | | ||
export NIX_PATH=nixpkgs=$(jq '.nixpkgs.url' nix/sources.json -r) | ||
echo "NIX_PATH=$NIX_PATH" >> $GITHUB_ENV | ||
nix-shell shell.nix --run "echo" | ||
- name: Go checks | ||
run: | | ||
nix-shell shell.nix --run "./scripts/go-checks.sh" | ||
lvm: | ||
needs: ['lint'] | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: DeterminateSystems/nix-installer-action@v11 | ||
with: | ||
kvm: true | ||
- uses: DeterminateSystems/magic-nix-cache-action@v6 | ||
- name: Pre-populate nix-shell | ||
run: | | ||
export NIX_PATH=nixpkgs=$(jq '.nixpkgs.url' nix/sources.json -r) | ||
echo "NIX_PATH=$NIX_PATH" >> $GITHUB_ENV | ||
nix-shell shell.nix --run "echo" | ||
- name: BootStrap k8s cluster | ||
run: | | ||
nix-shell shell.nix --run "./scripts/k8s/deployer.sh start --zfs --lvm" | ||
- name: Lvm e2e test | ||
run: | | ||
nix-shell shell.nix --run "./scripts/e2e-test.sh --testplan lvm" |
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,46 @@ | ||
#!/usr/bin/env bash | ||
|
||
set -eu | ||
|
||
SCRIPTDIR=$(dirname "$(realpath "$0")") | ||
EXITV_INVALID_OPTION=1 | ||
|
||
help() { | ||
cat <<EOF | ||
Usage: $0 [OPTIONS] | ||
Options: | ||
--testplan Test plan[lvm, zfs, hostpath, selfci etc.] | ||
Examples: | ||
$0 --testplan lvm | ||
EOF | ||
} | ||
|
||
# Parse arguments | ||
while [ "$#" -gt 0 ]; do | ||
case "$1" in | ||
-T|--testplan) | ||
shift | ||
testplan="$1" | ||
;; | ||
*) | ||
echo "Unknown option: $1" | ||
help | ||
exit $EXITV_INVALID_OPTION | ||
;; | ||
esac | ||
shift | ||
done | ||
|
||
echo "Testplan: $testplan" | ||
# Get the array elements from the command-line argument | ||
array_str=$(python3 $SCRIPTDIR/testlists.py --testplan $testplan --install) | ||
|
||
# Split the string into an array | ||
array=($array_str) | ||
|
||
# Iterate through the array | ||
for test in "${array[@]}"; do | ||
echo "Test: $test" | ||
$SCRIPTDIR/exec-tests.sh --tests $test --local true --product openebs --replicated_engine false | ||
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
''' | ||
Utility functions for e2e python3 scripts | ||
''' | ||
|
||
import os | ||
import sys | ||
import yaml | ||
|
||
e2e_root = os.path.realpath(sys.path[0] + '/..') | ||
|
||
def yaml_load(filename): | ||
''' | ||
utility function to load a yaml file | ||
''' | ||
with open(filename, encoding='UTF-8') as jfp: | ||
return yaml.safe_load(jfp.read()) | ||
|
||
|
||
def load_testplan(testplan): | ||
''' | ||
load a testplan, return testcases and array of testplan meta data | ||
''' | ||
tplan = yaml_load(e2e_root + f'/testplans/{testplan}.yaml') | ||
testsuites = tplan.get('testsuites', []) | ||
|
||
return testsuites | ||
|
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
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,46 @@ | ||
#!/usr/bin/env python3 | ||
""" | ||
Load a test list definition yaml file and | ||
output the list of tests for a specified profile | ||
The default delimiter is a space | ||
Optionally | ||
- change the delimiter | ||
- sort the list of tests alphbetically | ||
- return a list where each test is bracketed by install and uninstall | ||
- return a list which starts with install and ends with uninstall | ||
""" | ||
|
||
import e2e_util | ||
|
||
def main(args): | ||
""" | ||
The real main function | ||
""" | ||
tests = e2e_util.load_testplan(args.testplan) | ||
if args.install: | ||
tests.insert(0, 'install') | ||
if args.uninstall: | ||
tests.append('uninstall') | ||
for test in tests: | ||
# Code to execute for each element | ||
print(test) | ||
|
||
|
||
|
||
|
||
|
||
|
||
if __name__ == '__main__': | ||
from argparse import ArgumentParser | ||
|
||
parser = ArgumentParser() | ||
parser.add_argument('--testplan', dest='testplan', default=None, required=True, | ||
help='testplan') | ||
parser.add_argument('--install', dest='install', action='store_true', | ||
default=None, | ||
help='Add install before test list') | ||
parser.add_argument('--uninstall', dest='uninstall', action='store_true', | ||
default=None, | ||
help='Add uninstall after test list') | ||
|
||
main(parser.parse_args()) |
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,8 @@ | ||
meta: | ||
environment: {} | ||
name: 'install uninstall' | ||
description: 'install and uninstall tests' | ||
comment: This file includes the common set of testsuites for given testplan | ||
testsuites: | ||
- install | ||
- uninstall |
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,8 @@ | ||
meta: | ||
environment: {} | ||
name: 'hostpath' | ||
description: 'hostpath e2e tests' | ||
include: | ||
- common | ||
testsuites: | ||
- hostpath_volume_provisioning |
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,8 @@ | ||
meta: | ||
environment: {} | ||
name: 'lvm' | ||
description: 'lvm e2e tests' | ||
include: | ||
- common | ||
testsuites: | ||
- lvm_volume_provisioning |
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,8 @@ | ||
meta: | ||
environment: {} | ||
name: 'selfci' | ||
description: 'tests for e2e code validation' | ||
include: | ||
- common | ||
testsuites: | ||
- lvm_volume_provisioning |
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,8 @@ | ||
meta: | ||
environment: {} | ||
name: 'zfs' | ||
description: 'zfs e2e tests' | ||
include: | ||
- common | ||
testsuites: | ||
- zfs_volume_provisioning |