Skip to content

Commit

Permalink
[KOGITO-9465] - Fix behave test for the kogito-s2i-builder image (#1610)
Browse files Browse the repository at this point in the history
* [KOGITO-9465] - Fix behave test for the kogito-s2i-builder image

Signed-off-by: Spolti <[email protected]>

* test config

* try 2 builds in one scenario

* update

* correction

* Update tests/features/kogito-common-builder-jvm.feature

* Revert "test config"

This reverts commit 79eff86.

* Update feature files

* Update tests/features/kogito-s2i-builder-native.feature

* Update tests/test-apps/clone-repo.sh

* review

Signed-off-by: Spolti <[email protected]>

---------

Signed-off-by: Spolti <[email protected]>
Co-authored-by: radtriste <[email protected]>
Co-authored-by: Tristan Radisson <[email protected]>
  • Loading branch information
3 people authored Jul 26, 2023
1 parent 39d270f commit c56cdf9
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 58 deletions.
5 changes: 4 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,10 @@ NATIVE := true
clone-repos:
# if the NO_TEST env defined, proceed with the tests, as first step prepare the repo to be used
ifneq ($(ignore_test),true)
cd tests/test-apps && sh clone-repo.sh $(NATIVE)
ifneq ($(ignore_test_prepare),true)
cd tests/test-apps && export CONTAINER_ENGINE=$(BUILD_ENGINE) && sh clone-repo.sh $(NATIVE) $(image_name)
cd ../..
endif
endif

.PHONY: list
Expand Down
28 changes: 7 additions & 21 deletions tests/features/kogito-builder-native.feature
Original file line number Diff line number Diff line change
Expand Up @@ -83,32 +83,19 @@ Feature: kogito-builder image native build tests
# And s2i build log should contain '/home/kogito/bin/persons.proto' -> '/home/kogito/data/protobufs/persons.proto'
# And s2i build log should contain -J-Xmx5153960755

Scenario: Perform a incremental s2i build for native test
Given s2i build https://github.com/kiegroup/kogito-examples.git from rules-quarkus-helloworld with env and incremental using 1.13.x
Scenario: Perform an incremental s2i build for native test
Given s2i build https://github.com/kiegroup/kogito-examples.git from kogito-quarkus-examples/rules-quarkus-helloworld with env and incremental using nightly-main
| variable | value |
| RUNTIME_TYPE | quarkus |
| NATIVE | false |
Then s2i build log should not contain WARNING: Clean build will be performed because of error saving previous build artifacts
And file /home/kogito/bin/quarkus-run.jar should exist
And check that page is served
| property | value |
| port | 8080 |
| path | /hello |
| request_method | POST |
| content_type | application/json |
| request_body | {"strings":["hello"]} |
| wait | 80 |
| expected_phrase | ["hello","world"] |

# Since the same image is used we can do a subsequent incremental build and verify if it is working as expected.
Scenario:Perform a second incremental s2i build for native scenario, this time, with native enabled
Given s2i build https://github.com/kiegroup/kogito-examples.git from rules-quarkus-helloworld with env and incremental using 1.13.x
And s2i build https://github.com/kiegroup/kogito-examples.git from kogito-quarkus-examples/rules-quarkus-helloworld with env and incremental using nightly-main
| variable | value |
| RUNTIME_TYPE | quarkus |
| NATIVE | true |
| LIMIT_MEMORY | 6442450944 |
Then s2i build log should contain Expanding artifacts from incremental build...
And s2i build log should not contain WARNING: Clean build will be performed because of error saving previous build artifacts
Then s2i build log should not contain WARNING: Clean build will be performed because of error saving previous build artifacts
And s2i build log should contain Expanding artifacts from incremental build...
And s2i build log should contain -J-Xmx5153960755
And file /home/kogito/bin/rules-quarkus-helloworld-runner should exist
And check that page is served
| property | value |
Expand All @@ -118,8 +105,7 @@ Feature: kogito-builder image native build tests
| content_type | application/json |
| request_body | {"strings":["hello"]} |
| wait | 80 |
| expected_phrase | ["hello","world"] |
And s2i build log should contain -J-Xmx5153960755
| expected_phrase | ["hello","world"] |

Scenario: Verify that the Kogito Maven archetype is generating the project and compiling it correctly using native build
Given s2i build /tmp/kogito-examples from dmn-example using 1.13.x and runtime-image quay.io/kiegroup/kogito-runtime-native:latest
Expand Down
54 changes: 18 additions & 36 deletions tests/features/kogito-common-builder-jvm.feature
Original file line number Diff line number Diff line change
Expand Up @@ -85,31 +85,17 @@ Feature: kogito-builder image JVM build tests
| expected_phrase | ["hello","world"] |
And file /home/kogito/bin/quarkus-run.jar should exist

Scenario: Perform a incremental s2i build using quarkus runtime type
Given s2i build https://github.com/kiegroup/kogito-examples.git from rules-quarkus-helloworld with env and incremental using 1.13.x
Scenario: Perform an incremental s2i build using quarkus runtime type
Given s2i build https://github.com/kiegroup/kogito-examples.git from kogito-quarkus-examples/rules-quarkus-helloworld with env and incremental using nightly-main
| variable | value |
| RUNTIME_TYPE | quarkus |
| NATIVE | false |
Then s2i build log should not contain WARNING: Clean build will be performed because of error saving previous build artifacts
And file /home/kogito/bin/quarkus-run.jar should exist
And check that page is served
| property | value |
| port | 8080 |
| path | /hello |
| request_method | POST |
| content_type | application/json |
| request_body | {"strings":["hello"]} |
| wait | 80 |
| expected_phrase | ["hello","world"] |

# Since the same image is used we can do a subsequent incremental build and verify if it is working as expected.
Scenario: Perform a second incremental s2i build using quarkus runtime type
Given s2i build https://github.com/kiegroup/kogito-examples.git from rules-quarkus-helloworld with env and incremental using 1.13.x
And s2i build https://github.com/kiegroup/kogito-examples.git from kogito-quarkus-examples/rules-quarkus-helloworld with env and incremental using nightly-main
| variable | value |
| RUNTIME_TYPE | quarkus |
| NATIVE | false |
Then s2i build log should contain Expanding artifacts from incremental build...
And s2i build log should not contain WARNING: Clean build will be performed because of error saving previous build artifacts
Then s2i build log should not contain WARNING: Clean build will be performed because of error saving previous build artifacts
And s2i build log should contain Expanding artifacts from incremental build...
And file /home/kogito/bin/quarkus-run.jar should exist
And check that page is served
| property | value |
Expand All @@ -121,7 +107,6 @@ Feature: kogito-builder image JVM build tests
| wait | 80 |
| expected_phrase | ["hello","world"] |


#### SpringBoot Scenarios

Scenario: Verify if the s2i build is finished as expected with debug enabled
Expand Down Expand Up @@ -198,30 +183,27 @@ Feature: kogito-builder image JVM build tests
And container log should contain Started KogitoSpringbootApplication
And run sh -c 'echo $JAVA_OPTIONS' in container and immediately check its output for -Ddebug=true

Scenario: Perform a incremental s2i build using springboot runtime type
Given s2i build https://github.com/kiegroup/kogito-examples.git from ruleunit-springboot-example with env and incremental using 1.13.x
Scenario: Perform an incremental s2i build using springboot runtime type
Given s2i build https://github.com/kiegroup/kogito-examples.git from kogito-springboot-examples/process-springboot-example with env and incremental using nightly-main
# Leave those here as placeholder for scripts adding variable to the test. No impact on tests if empty.
| variable | value |
| RUNTIME_TYPE | springboot |
Then check that page is served
| property | value |
| port | 8080 |
| path | /find-approved |
| wait | 80 |
| request_method | POST |
| request_body | {"maxAmount":5000,"loanApplications":[{"id":"ABC10001","amount":2000,"deposit":100,"applicant":{"age":45,"name":"John"}}]} |
| content_type | application/json |
| expected_status_code | 200 |
And file /home/kogito/bin/ruleunit-springboot-example.jar should exist

# Since the same image is used we can do a subsequent incremental build and verify if it is working as expected.
Scenario: Perform a second incremental s2i build using springboot runtime type
Given s2i build https://github.com/kiegroup/kogito-examples.git from ruleunit-springboot-example with env and incremental using 1.13.x
And s2i build https://github.com/kiegroup/kogito-examples.git from kogito-springboot-examples/process-springboot-example with env and incremental using nightly-main
# Leave those here as placeholder for scripts adding variable to the test. No impact on tests if empty.
| variable | value |
| RUNTIME_TYPE | springboot |
Then s2i build log should contain Expanding artifacts from incremental build...
And s2i build log should not contain WARNING: Clean build will be performed because of error saving previous build artifacts
And file /home/kogito/bin/process-springboot-example.jar should exist
And check that page is served
| property | value |
| port | 8080 |
| path | /orders |
| wait | 80 |
| request_method | POST |
| request_body | {"approver" : "john", "order" : {"orderNumber" : "12345", "shipped" : false}} |
| content_type | application/json |
| expected_status_code | 201 |

Scenario: Verify if the s2i build is finished as expected with uber-jar package type built
Given s2i build https://github.com/kiegroup/kogito-examples.git from ruleunit-quarkus-example using 1.13.x and runtime-image quay.io/kiegroup/kogito-runtime-jvm:latest
Expand Down

0 comments on commit c56cdf9

Please sign in to comment.