-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Boiler plate * Make the tests run * Truncate output file/dir before the export * Make export transactions test run * Update the golden files * prettier * omit long running tests * Make all the tests work * prettier * update * Make all the test run * Add workflow to run integration tests * revert me * Fix docker compose in workflow * use secret add secret as env variable in github workflow remove env from docker compose * pass env directly in docker compose run mount file and pass env remove extra env temp cat temp empty printf rearrange validate json workaround cleanup verbose * Fail the test intentionally * Revert "Fail the test intentionally" This reverts commit 1d39d47. * find test coverage * test overrides * Revert "test overrides" This reverts commit b797bdf. * add coverage report and readme Fix coverage report coverage fix * lower our test coverage standard * Remove duplicate functions * Add make command for lint * Cancel the previous runs if new commit is pushed * rename the job * Update cmd/export_ledger_entry_changes_test.go * Update cmd/export_ledgers_test.go * Rename contract event golden file
- Loading branch information
1 parent
ffb4b4a
commit c7991a5
Showing
46 changed files
with
163,611 additions
and
3,216 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
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,67 @@ | ||
name: Integration Tests | ||
|
||
on: | ||
push: | ||
branches: | ||
- master | ||
pull_request: | ||
branches: | ||
- master | ||
|
||
concurrency: | ||
group: ${{ github.workflow }}-${{ github.ref_protected == 'true' && github.sha || github.ref }}-{{ github.event_name }} | ||
cancel-in-progress: true | ||
|
||
jobs: | ||
integration-tests: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v3 | ||
|
||
- name: Set up Docker Compose | ||
run: | | ||
sudo apt-get update | ||
sudo apt-get install -y docker-compose | ||
- name: Build Docker Image | ||
run: | | ||
docker-compose build | ||
- name: Build and start services | ||
run: | | ||
docker-compose up -d | ||
- name: Create GCP Credentials File | ||
run: | | ||
echo "$CREDS_TEST_HUBBLE" > ${{ runner.workspace }}/gcp-key.json | ||
shell: bash | ||
env: | ||
CREDS_TEST_HUBBLE: ${{secrets.CREDS_TEST_HUBBLE}} | ||
|
||
- name: Run tests | ||
run: | | ||
docker-compose run -v ${{ runner.workspace }}/gcp-key.json:/usr/credential.json:ro \ | ||
-v ${{ runner.workspace }}/coverage/:/usr/coverage/ \ | ||
-e GOOGLE_APPLICATION_CREDENTIALS=/usr/credential.json \ | ||
integration-tests \ | ||
go test -v -coverprofile=/usr/coverage/coverage.out ./cmd ./internal/transform -timeout 30m | ||
- name: Generate Coverage Report | ||
run: | | ||
go tool cover -func=${{ runner.workspace }}/coverage/coverage.out | ||
- name: Check Coverage | ||
id: coverage | ||
run: | | ||
COVERAGE=$(go tool cover -func=${{ runner.workspace }}/coverage/coverage.out | grep total: | awk '{print $3}' | sed 's/%//') | ||
echo "Coverage: $COVERAGE%" | ||
if (( $(echo "$COVERAGE < 55" | bc -l) )); then | ||
echo "Coverage is below the 55% threshold." | ||
exit 1 | ||
fi | ||
- name: Stop and remove containers | ||
run: | | ||
docker-compose down |
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
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
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
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,20 @@ | ||
package cmd | ||
|
||
import ( | ||
"testing" | ||
) | ||
|
||
func TestExportContractEvents(t *testing.T) { | ||
tests := []cliTest{ | ||
{ | ||
name: "contract events from multiple ledger", | ||
args: []string{"export_contract_events", "-s", "52271338", "-e", "52271350", "-o", gotTestDir(t, "large_range_ledger_txs.txt")}, | ||
golden: "large_range_ledger_txs.golden", | ||
wantErr: nil, | ||
}, | ||
} | ||
|
||
for _, test := range tests { | ||
runCLITest(t, test, "testdata/contract_events/") | ||
} | ||
} |
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,20 @@ | ||
package cmd | ||
|
||
import ( | ||
"testing" | ||
) | ||
|
||
func TestExportLedgerTransaction(t *testing.T) { | ||
tests := []cliTest{ | ||
{ | ||
name: "Transactions from one ledger", | ||
args: []string{"export_ledger_transaction", "-s", "30820015", "-e", "30820015", "-o", gotTestDir(t, "ledger_transactions.txt")}, | ||
golden: "ledger_transactions.golden", | ||
wantErr: nil, | ||
}, | ||
} | ||
|
||
for _, test := range tests { | ||
runCLITest(t, test, "testdata/ledger_transactions/") | ||
} | ||
} |
Oops, something went wrong.