Skip to content

Commit

Permalink
[1.13.x-blue-next] [KOGITO-9465] - Fix behave test for the kogito-s2i…
Browse files Browse the repository at this point in the history
…-builder image (#1648)

* [KOGITO-9465] - Fix behave test for the kogito-s2i-builder image (#1610)

* [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]>

* Update Makefile

---------

Signed-off-by: Spolti <[email protected]>
Co-authored-by: Filippe Spolti <[email protected]>
Co-authored-by: radtriste <[email protected]>
Co-authored-by: Tristan Radisson <[email protected]>
  • Loading branch information
4 people authored Jul 26, 2023
1 parent 524f07d commit 783f8ed
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 57 deletions.
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 nightly-1.13.x-blue
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 nightly-1.13.x-blue
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 nightly-1.13.x-blue 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 @@ -86,31 +86,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 nightly-1.13.x-blue
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 nightly-1.13.x-blue
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 @@ -122,7 +108,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 @@ -199,30 +184,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 nightly-1.13.x-blue
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 nightly-1.13.x-blue
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 nightly-1.13.x-blue and runtime-image quay.io/kiegroup/kogito-runtime-jvm:latest
Expand Down

0 comments on commit 783f8ed

Please sign in to comment.