-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
670d07a
commit c6c1b91
Showing
3 changed files
with
91 additions
and
0 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,41 @@ | ||
name: Test Examples | ||
|
||
on: pull_request | ||
#workflow_dispatch | ||
|
||
jobs: | ||
test-tcp-echo: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
- name: Create k8s Kind Cluster | ||
uses: helm/kind-action@v1 | ||
- name: Execute Test | ||
run: | | ||
cd tcp.echo | ||
./setup.sh | ||
./test.sh | tee -a $GITHUB_STEP_SUMMARY | ||
- name: Teardown | ||
if: always() | ||
run: | | ||
cd tcp.echo | ||
./teardown.sh | ||
test-tls-echo: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
- name: Create k8s Kind Cluster | ||
uses: helm/kind-action@v1 | ||
- name: Execute Test | ||
run: | | ||
cd tls.echo | ||
./setup.sh | ||
./test.sh | tee -a $GITHUB_STEP_SUMMARY | ||
- name: Teardown | ||
if: always() | ||
run: | | ||
cd tls.echo | ||
./teardown.sh |
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,25 @@ | ||
#!/bin/bash | ||
set -x | ||
# GIVEN | ||
PORT="12345" | ||
INPUT="ZZZ Hello, Zilla!" | ||
EXPECTED="Hello, Zilla!" | ||
echo \# Testing tcp.echo | ||
echo PORT=$PORT | ||
echo INPUT=$INPUT | ||
echo EXPECTED=$EXPECTED | ||
echo | ||
|
||
# WHEN | ||
OUTPUT=$(echo $INPUT | nc -w 1 localhost $PORT) | ||
RESULT=$? | ||
echo OUTPUT=$OUTPUT | ||
echo RESULT=$RESULT | ||
|
||
# THEN | ||
if [ $RESULT -eq 0 ] && [ "$OUTPUT" == "$EXPECTED" ]; then | ||
echo ✅ | ||
else | ||
echo ❌ | ||
exit 1 | ||
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,25 @@ | ||
#!/bin/bash | ||
|
||
# GIVEN | ||
PORT="23456" | ||
INPUT="Hello, Zilla!" | ||
EXPECTED="Hello, Zilla!" | ||
echo \# Testing tls.echo | ||
echo PORT=$PORT | ||
echo INPUT=$INPUT | ||
echo EXPECTED=$EXPECTED | ||
echo | ||
|
||
# WHEN | ||
OUTPUT=$(echo $INPUT | timeout 2 openssl s_client -connect localhost:$PORT -CAfile test-ca.crt -quiet -alpn echo) | ||
RESULT=$? | ||
echo OUTPUT=$OUTPUT | ||
echo RESULT=$RESULT | ||
|
||
# THEN | ||
if [ $RESULT -eq 124 ] && [ "$OUTPUT" == "$EXPECTED" ]; then | ||
echo ✅ | ||
else | ||
echo ❌ | ||
exit 1 | ||
fi |