-
Notifications
You must be signed in to change notification settings - Fork 26
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
Issues/216 - Import e2e cucumber tests into casper-java-sdk #217
Closed
Closed
Changes from 15 commits
Commits
Show all changes
47 commits
Select commit
Hold shift + click to select a range
a37bfb8
issues/216 - Moved over cucumber step definition classes into casper-…
meywood 1601e1d
issues/216 - Added [email protected]:stormeye2000/cspr-standard-tests-re…
meywood e018714
issues/216 - Updated CasperTransferHelperTests and CasperServiceTest…
meywood 7ef9ba1
issues/216 - Added script to debug e2e tests
meywood 91987f9
issues/216 - Fix warnings detected by static code analysis
meywood 862227b
issues/216 - Tidy up of branch prior to PR
meywood fe6813c
issues/216 - Update github gradle.yml action to use new docker-copy-a…
meywood 413b0f2
issues/216 - Update github gradle.yml to use cspr-nctl:linux-1.5.2
meywood 40f8e88
issues/216 - Moved reports into standard gradle reports folder
meywood ce4c5a0
issues/216 - Fixed state_get_balance to work with changes to nctl.
meywood cec2b4b
issues/216 - Added github actions to execute e2e tests and publish re…
meywood b801bba
issues/216 - Added bootstrap script to GitHub action prior to executi…
meywood 257b95d
issues/216 - Added bootstrap script to GitHub action prior to executi…
meywood e914f86
issues/216 - Added submodules recursive checkout
meywood 6755c7d
issues/216 - Reduced logging for event handling and added 'continue-o…
meywood 87cb931
issues/216 - Code review updates
meywood 874a38c
issues/216 - Added more info to e2e-remote-debug script description
meywood 4acf624
issues/216 - Added symbolic link to the features folder to allow Inte…
meywood 56c6ea8
issues/216 - Added symbolic link to the features folder to allow Inte…
meywood bdb2e1a
issues/216 - Added symbolic link to the features folder to allow Inte…
meywood c8ef511
issues/216 - Remove old git submodule cspr-standard-tests-resources i…
meywood 0f4c95a
issues/216 - Updated git submodule to https://github.com/casper-netwo…
meywood 0919157
issues/216 - Fixed errors in bootstrap script
meywood 8eedab3
issues/216 - Updated gradle project to support new git submodule sdk-…
meywood 62c47f7
issues/216 - Fixed incorrect feature regex in DeployGeneratedKeys
meywood d8d648a
issues/216 - Change json resource path
meywood 4eb2b30
issues-216 - Fixed typo in bootstrap
meywood 74119e6
Merge remote-tracking branch 'origin/issues/216' into issues/216
meywood 3610f8a
issues/222 - query_balance.feature
meywood f2681db
issues/222 - query_balance.feature
meywood 454e0ec
issues/222 - tidy up for review
meywood 6a0a206
Merge pull request #223 from casper-network/issues/222
cnorburn 62a91d8
issues/222 - implemented missing scenarios for state identifiers
meywood cea0bf1
issues/222 - implemented missing scenarios for state identifiers
meywood 02a74a4
Merge pull request #224 from casper-network/issues/222
cnorburn 32365c9
issues/222 - implemented missing scenarios for state identifiers
meywood 447bede
Merge branch 'issues/222' into issues/216
meywood e4a3e05
Update QueryBalanceStepDefinitions.java
meywood eca374c
issues/225 - speculative_execution.feature
meywood 182c2da
Merge pull request #226 from casper-network/issues/225
cnorburn c77e14d
issues/225 - speculative_execution.feature improvement
meywood 68ce4f9
Merge pull request #227 from casper-network/issues/225
cnorburn 6a8c805
issues/228 - Nested CLTuples
meywood 00f56f3
issues/228 - Tidy up for review of nested CLTuples
meywood 6e2dc6b
issues/228 - Tidy up for review of nested CLTuples
meywood f785776
issues/228 - Reformat private functions to end of file
meywood de15ceb
Merge pull request #229 from casper-network/issues/228
cnorburn File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 |
---|---|---|
|
@@ -15,7 +15,7 @@ jobs: | |
runs-on: ubuntu-latest | ||
services: | ||
nctl: | ||
image: stormeye2000/cspr-nctl:1.5 | ||
image: stormeye2000/cspr-nctl:linux-1.5.2 | ||
options: --name cspr-nctl | ||
env: | ||
PREDEFINED_ACCOUNTS: 'true' | ||
|
@@ -36,6 +36,8 @@ jobs: | |
|
||
- name: Checkout code | ||
uses: actions/checkout@v2 | ||
with: | ||
submodules: recursive | ||
|
||
- name: Set up JDK 11 | ||
uses: actions/setup-java@v2 | ||
|
@@ -49,7 +51,7 @@ jobs: | |
# Copy the assets from the NCTL docker image and build | ||
- name: Build and test with Gradle | ||
run: | | ||
cd sh && chmod +x docker-copy-assets.sh && ./docker-copy-assets.sh && cd .. | ||
cd script && chmod +x docker-copy-assets && ./docker-copy-assets && cd .. | ||
./gradlew clean build | ||
|
||
- name: Export project version | ||
|
@@ -74,6 +76,10 @@ jobs: | |
folder: build/reports/jacoco | ||
target-folder: docs/latest/jacoco | ||
|
||
- name: e2e tests | ||
run: ./script/e2e-test | ||
continue-on-error: true | ||
|
||
- name: Deploy to GitHub Pages | ||
uses: JamesIves/[email protected] | ||
with: | ||
|
@@ -106,4 +112,8 @@ jobs: | |
folder: build/docs/javadoc | ||
target-folder: docs/${{ env.PROJECT_VERSION }}/javadoc | ||
|
||
|
||
- name: Publish e2e tests | ||
uses: deblockt/[email protected] | ||
with: | ||
access-token: ${{ secrets.GITHUB_TOKEN }} | ||
path: "**/cucumber-report.json" |
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 |
---|---|---|
|
@@ -38,3 +38,5 @@ out/ | |
.vscode/* | ||
!.vscode/tasks.json | ||
!.vscode/launch.json | ||
/assets/ | ||
/reports/ |
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,3 @@ | ||
[submodule "cspr-standard-tests-resources"] | ||
path = cspr-standard-tests-resources | ||
url = [email protected]:stormeye2000/cspr-standard-tests-resources.git |
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
Submodule cspr-standard-tests-resources
added at
e1c377
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,14 @@ | ||
#!/usr/bin/env bash | ||
cd "$(dirname "$0")" || exit | ||
echo "Bootstrap installs all dependencies." | ||
|
||
echo "Installing features from [email protected]:stormeye2000/cspr-standard-tests-resources.git" | ||
|
||
if [ -d "../cspr-standard-test-resources" ] | ||
then | ||
echo "cspr-standard-test-resources exists fetching submodules." | ||
git submodule update --init --recursive | ||
else | ||
echo "Cloning cspr-standard-test-resources as submodule." | ||
git submodule add [email protected]:stormeye2000/cspr-standard-tests-resources.git ../cspr-standard-tests-resources | ||
fi |
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,3 @@ | ||
#!/usr/bin/env bash | ||
# opens a bash shell against the casper nctl docker container | ||
docker exec -it cspr-nctl bash |
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,11 @@ | ||
#!/usr/bin/env bash | ||
BASEDIR=$(builtin cd .. || exit 1; pwd) | ||
# clear the assets folder | ||
rm -rf "${BASEDIR}/assets" | ||
mkdir "${BASEDIR}/assets" | ||
# copy net-1 users | ||
docker cp cspr-nctl:/home/casper/casper-node/utils/nctl/assets/net-1/users "${BASEDIR}/assets/net-1" | ||
# copy net-1 chainspec | ||
docker cp cspr-nctl:/home/casper/casper-node/utils/nctl/assets/net-1/chainspec "${BASEDIR}/assets/net-1" | ||
# copy faucet keys | ||
docker cp cspr-nctl:/home/casper/casper-node/utils/nctl/assets/net-1/faucet "${BASEDIR}/assets/net-1" |
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,3 @@ | ||
#!/usr/bin/env bash | ||
# run the cspr-nctl container in docker | ||
docker run --rm -it --name cspr-nctl -d -p 25101:25101 -p 11101:11101 -p 14101:14101 -p 18101:18101 stormeye2000/cspr-nctl:linux-1.5.2 |
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,3 @@ | ||
#!/usr/bin/env bash | ||
# stop the cspr-nctl docker container | ||
docker stop cspr-nctl |
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 @@ | ||
#!/usr/bin/env bash | ||
# remote debugs one or more cucumber e2e tests, the 1st parameter is the cucumber name regex eg: | ||
# ./script/e2e-remote-debug info_get_peers | ||
# The above example will start the JVM in debug mode and only execute the info_get_peers scenario. | ||
|
||
cd "$(dirname "$0")/.."|| exit 1 | ||
./gradlew --stop | ||
./gradlew cucumber -Dorg.gradle.jvmargs='-Xdebug -agentlib:jdwp=transport=dt_socket,server=y,suspend=y,address=5005;' -Dcucumber.name="${1}" --no-daemon |
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,7 @@ | ||
#!/usr/bin/env bash | ||
# executes the cucumber e2e tests against a docker instance | ||
cd "$(dirname "$0")/.." || exit 1 | ||
# to run tests filtered by regex use the following: | ||
# ./script/e2e-test -Dcucumber.name=info_get_status | ||
# where info_get_status is the pattern to filter on | ||
./gradlew cucumber "$@" |
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 @@ | ||
#!/usr/bin/env bash | ||
cd "$(dirname "$0")" || exit | ||
cd .. | ||
echo "Removes all test resources git submodules." | ||
git submodule deinit -f cspr-standard-tests-resources | ||
rm -rf .git/modules/cspr-standard-tests-resources | ||
git rm -f cspr-standard-tests-resources | ||
rm .gitmodules |
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,5 @@ | ||
#!/usr/bin/env bash | ||
# executes the JUnit tests. To execute the cucumber test use the e2e-test script | ||
cd "$(dirname "$0")/.." || exit 1 | ||
./gradlew test "$@" | ||
|
This file was deleted.
Oops, something went wrong.
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,69 @@ | ||
package com.casper.sdk.e2e.event; | ||
|
||
import com.casper.sdk.e2e.matcher.MatcherMap; | ||
import com.casper.sdk.e2e.utils.CasperClientProvider; | ||
import com.casper.sdk.model.event.Event; | ||
import com.casper.sdk.model.event.EventTarget; | ||
import com.casper.sdk.model.event.EventType; | ||
import org.hamcrest.Matcher; | ||
import org.slf4j.Logger; | ||
import org.slf4j.LoggerFactory; | ||
|
||
import java.util.ArrayList; | ||
import java.util.List; | ||
|
||
|
||
/** | ||
* Helper class for consuming and matching events. | ||
* | ||
* @author [email protected] | ||
*/ | ||
public class EventHandler { | ||
|
||
private final Logger logger = LoggerFactory.getLogger(EventHandler.class); | ||
private final MatcherMap matcherMap = new MatcherMap(); | ||
private final List<AutoCloseable> sseSources = new ArrayList<>(); | ||
|
||
public EventHandler(final EventTarget eventTarget) { | ||
consume(EventType.DEPLOYS, eventTarget); | ||
consume(EventType.MAIN, eventTarget); | ||
consume(EventType.SIGS, eventTarget); | ||
} | ||
|
||
public void close() { | ||
|
||
for (AutoCloseable sseSource : sseSources) { | ||
try { | ||
sseSource.close(); | ||
} catch (Exception e) { | ||
logger.error("Error closing SSE Source", e); | ||
} | ||
} | ||
} | ||
|
||
private void consume(final EventType eventType, final EventTarget eventTarget) { | ||
|
||
logger.info("Got {} event {}", eventType, eventTarget); | ||
sseSources.add( | ||
CasperClientProvider.getInstance().getEventService().consumeEvents( | ||
eventType, | ||
eventTarget, null, | ||
this::handleMatchers, | ||
throwable -> logger.error("Error processing SSE event", throwable) | ||
) | ||
); | ||
} | ||
|
||
public <T> Matcher<T> addEventMatcher(final EventType eventType, final Matcher<T> matcher) { | ||
matcherMap.addEventMatcher(eventType, matcher); | ||
return matcher; | ||
} | ||
|
||
private void handleMatchers(Event<?> event) { | ||
matcherMap.handleEvent(event); | ||
} | ||
|
||
public <T> void removeEventMatcher(final EventType eventType, final Matcher<T> matcher) { | ||
matcherMap.removeEventMatcher(eventType, matcher); | ||
} | ||
} |
12 changes: 12 additions & 0 deletions
12
src/test/java/com/casper/sdk/e2e/exception/NctlCommandException.java
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,12 @@ | ||
package com.casper.sdk.e2e.exception; | ||
|
||
public class NctlCommandException extends RuntimeException { | ||
|
||
public NctlCommandException(final Throwable cause) { | ||
super(cause); | ||
} | ||
|
||
public NctlCommandException(final String message) { | ||
super("NCTL command failed with: " + message); | ||
} | ||
} |
7 changes: 7 additions & 0 deletions
7
src/test/java/com/casper/sdk/e2e/exception/NotImplementedException.java
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,7 @@ | ||
package com.casper.sdk.e2e.exception; | ||
|
||
public class NotImplementedException extends RuntimeException { | ||
public NotImplementedException(final String message) { | ||
super(message); | ||
} | ||
} |
13 changes: 13 additions & 0 deletions
13
src/test/java/com/casper/sdk/e2e/exception/TestException.java
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,13 @@ | ||
package com.casper.sdk.e2e.exception; | ||
|
||
/** | ||
* Exception thrown by e2e tests. | ||
* | ||
* @author [email protected] | ||
*/ | ||
public class TestException extends RuntimeException { | ||
|
||
public TestException(Throwable cause) { | ||
super(cause); | ||
} | ||
} |
11 changes: 11 additions & 0 deletions
11
src/test/java/com/casper/sdk/e2e/exception/TimeoutException.java
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,11 @@ | ||
package com.casper.sdk.e2e.exception; | ||
|
||
/** | ||
* @author [email protected] | ||
*/ | ||
public class TimeoutException extends RuntimeException { | ||
|
||
public TimeoutException(final String message) { | ||
super(message); | ||
} | ||
} |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add a step by step description of what the action is doing