diff --git a/Makefile b/Makefile index d917e51d..241bec01 100644 --- a/Makefile +++ b/Makefile @@ -260,7 +260,7 @@ mindwm_test: python3 -m venv .venv && \ source .venv/bin/activate && \ pip3 install -r ./requirements.txt && \ - pytest -s -x -m mindwm_test --no-header --junit-xml=$(ARTIFACT_DIR)/report.xml --disable-warnings -vv --gherkin-terminal-reporter --kube-config=$${HOME}/.kube/config --alluredir=$(ARTIFACT_DIR)/allure-results . | tee $(ARTIFACT_DIR)/report.md + pytest -s -x -m 'mindwm_lifecycle or mindmap_terminal' --no-header --junit-xml=$(ARTIFACT_DIR)/report.xml --disable-warnings -vv --gherkin-terminal-reporter --kube-config=$${HOME}/.kube/config --alluredir=$(ARTIFACT_DIR)/allure-results . | tee $(ARTIFACT_DIR)/report.md exit_code=$${PIPESTATUS[0]} echo $${exit_code} > $(ARTIFACT_DIR)/exit_code xmlstarlet sel -t -m "//testcase[failure]" -v "concat(@classname,' ', @name)" -n $(ARTIFACT_DIR)/report.xml | tee $(ARTIFACT_DIR)/failed_test_title diff --git a/config_schema.k b/config_schema.k index 21733d7e..962d74a5 100644 --- a/config_schema.k +++ b/config_schema.k @@ -87,7 +87,7 @@ schema MindwmContext: } kafka_cdc: KnativeFunction { name.data = "kafka-cdc" - image = "ghcr.io/mindwm/knfunc-kafka-cdc:1.0.4" + image = "ghcr.io/mindwm/knfunc-kafka-cdc:1.0.6" } pong: KnativeFunction { name.data = "pong" diff --git a/tests/e2e/cloud-init.yaml b/tests/e2e/cloud-init.yaml index d47c5f18..5fa49d0f 100644 --- a/tests/e2e/cloud-init.yaml +++ b/tests/e2e/cloud-init.yaml @@ -13,6 +13,14 @@ packages: - tmux - ripgrep - xmlstarlet + # for mindmap-terminal tests + - wmctrl + - xdotool + - fvwm3 + - xvfb + - wget + - openjdk-17-jdk + - xterm groups: - ci - docker @@ -44,3 +52,4 @@ runcmd: - sysctl -w fs.inotify.max_queued_events=2099999999 - curl -Lo /usr/bin/kubectl https://dl.k8s.io/release/v1.32.0/bin/linux/amd64/kubectl - chmod +x /usr/bin/kubectl + - update-java-alternatives --set java-1.17.0-openjdk-amd64 diff --git a/tests/e2e/main.tf b/tests/e2e/main.tf index f5a80394..65e6a531 100644 --- a/tests/e2e/main.tf +++ b/tests/e2e/main.tf @@ -87,7 +87,7 @@ resource "linode_instance" "ci" { inline = [ "mkdir -p ${var.artifact_dir}", "echo 0 > ${var.artifact_dir}/exit_code", - "timeout 90 bash -c 'while :; do docker info && break; sleep 1; echo -n .; done'", + "timeout 270 bash -c 'while :; do docker info && break; sleep 1; echo -n .; done'", # "echo dir: `basename ${var.git_repository}` checkout ${var.git_commit_sha} TARGET_REVISION=${var.git_ref_name}", #"cd `basename ${var.git_repository}` && make mindwm_lifecycle sleep-300 mindwm_test ARTIFACT_DIR=${var.artifact_dir} TARGET_REVISION=${var.git_ref_name} || echo $? > ${var.artifact_dir}/exit_code", #"cd ${var.artifact_dir} && tar cvf /tmp/artifacts.tar *" diff --git a/tests/mindwm_bdd/features/6_0_0_mindmap_terminal_freeplane.feature b/tests/mindwm_bdd/features/6_0_0_mindmap_terminal_freeplane.feature new file mode 100644 index 00000000..6b767b98 --- /dev/null +++ b/tests/mindwm_bdd/features/6_0_0_mindmap_terminal_freeplane.feature @@ -0,0 +1,128 @@ +@mindmap_terminal +@mindwm_test + +Feature: Mindmap terminal integration test + Background: + Given A MindWM environment + Then all nodes in Kubernetes are ready + + Scenario: Install freeplane + When God runs the command 'wget -c -O /tmp/freeplane.deb https://sourceforge.net/projects/freeplane/files/freeplane%20stable/archive//freeplane_1.12.9~upstream-1_all.deb/download' inside the '' directory + When God runs the command 'sudo dpkg -i /freeplane.deb' inside the '' directory + Examples: + | freeplane_version | work_dir | display | + | 1.12.9 | /tmp/ | 42 | + + + Scenario: Prepare environment, context: , username: , host: + When God creates a MindWM context with the name "" + Then the context should be ready and operable + + And the following deployments are in a ready state in the "context-" namespace + | Deployment name | + | iocontext-00001-deployment | + + And the following resources of type "services.serving.knative.dev/v1" has a status "Ready" equal "True" in "context-" namespace + | Knative service name | + | iocontext | + + And statefulset "-neo4j" in namespace "context-" is in ready state + + When God creates a MindWM user resource with the name "" and connects it to the context "" + Then the user resource should be ready and operable + + When God creates a MindWM host resource with the name "" and connects it to the user "" + Then the host resource should be ready and operable + + Examples: + | context | username | host | + | headwind | ci | localhost | + + Scenario: Clone @ to + When God clones the repository '' with branch '' and commit '' to '' + Then the directory '' should exist + + Examples: + | repo | branch | commit | clone_dir | + | https://github.com/mindwm/mindmap-terminal | master | HEAD | /tmp/mindmap-terminal | + | https://github.com/mindwm/mindwm-manager | master | HEAD | /tmp/mindwm-manager | + + Scenario: Install, configure and run mindwm-manager + Then the directory '' should exist + When God runs the command 'python3.11 -m venv .venv' inside the '' directory + When God runs the command '.venv/bin/pip install -r requirements.txt' inside the '' directory + When God runs the command 'set -a && . /.env.sample && //.venv/bin/python3.11 src/manager.py > /log 2>&1 &' inside the '' directory + Then God waits for '5' seconds + When God runs the command 'pgrep -fx "^//tmp/mindwm-manager/.venv/bin/python3.11 src/manager.py$"' inside the '' directory + Then file "/log" should not contain "Traceback \(most recent call last\):" regex + Then file "/log" contain "INFO:mindwm.events:Subscribed to NATS subject:.*" regex + + Examples: + | work_dir | + | /tmp/mindwm-manager | + + Scenario: Run xvfb server at : port + When God runs the command 'nohup Xvfb : -screen 0 1024x768x16 > /tmp/x 2>&1 &' inside the '' directory + When God runs the command 'nohup fvwm3 -d : >/tmp/y 2>&1 &' inside the '' directory + When God runs the command 'pgrep -f ^Xvfb' inside the '' directory + When God runs the command 'pgrep -f ^fvwm3' inside the '' directory + + Examples: + | display | work_dir | + | 42 | /tmp | + + Scenario: Run freeplane + When God runs the command 'export DISPLAY=:; make freeplane_start > /log 2>&1 &' inside the '' directory + Then God waits for '10' seconds + When God runs the command 'DISPLAY=: wmctrl -l | grep Freeplane' inside the '' directory + Then God waits for '20' seconds + When God runs the command 'DISPLAY=: wmctrl -l | grep -E "mindmap-terminal-[0-9]+-Map[0-9]+?-ID_[0-9]+"' inside the '' directory + + Examples: + | work_dir | display | + | /tmp/mindmap-terminal | 42 | + + Scenario: Run test + When God runs the command 'export DISPLAY=:; xdotool search --name "freeplane" windowactivate' inside the '' directory + Then God waits for '3' seconds + When God runs the command 'export DISPLAY=:; xdotool key Escape' inside the '' directory + Then God waits for '3' seconds + When God runs the command 'export DISPLAY=:; xdotool type ""' inside the '' directory + Then God waits for '3' seconds + When God runs the command 'export DISPLAY=:; xdotool key Return' inside the '' directory + Examples: + | work_dir | display | command | + | /tmp/mindmap-terminal | 42 | uptime | + # + # + Scenario: Verification that the io-document has been delivered and processed + Then the following deployments are in a ready state in the "context-" namespace + | Deployment name | + | iocontext-00001-deployment | + And container "user-container" in pod "iocontext-00001-deployment.*" in namespace "context-" should contain "uptime" regex + And container "user-container" in pod "^.*-00001-deployment-.*" in namespace "context-" should not contain "Traceback \(most recent call last\):" regex + And container "user-container" in pod "^dead-letter-.*" in namespace "context-" should not contain "cloudevents.Event\n" regex + + Examples: + | context | username | host | command | + | headwind | ci | localhost | uptime | + + Scenario: Cleanup process + When God runs the command 'pgrep -f "" && (pkill -9 -f "") || :' inside the '/tmp' directory + Examples: + | proc_mask | + | ^Xvfb | + | ^fvwm3 | + | ^xterm | + | ^//tmp/mindwm-manager/.venv/bin/python3.11 src/manager.py$ | + + + Scenario: Cleanup @ in + When God deletes the MindWM context resource "" + And God deletes the MindWM host resource "" + And God deletes the MindWM user resource "" + And God runs the command 'sudo dpkg -r freeplane' inside the '/tmp' directory + + Examples: + | context | username | host | + | headwind | ci | localhost |