mirror of https://github.com/VinGarcia/ksql.git
Fix run-all-tests.sh script so it adds the replace directive
parent
f6ed380095
commit
34d0fc0236
|
@ -1,6 +1,22 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
# Make sure the script will stop on error:
|
||||
set -ueo pipefail
|
||||
|
||||
# Generate the coverate.txt file for all modules:
|
||||
find . -name go.mod -execdir go test -coverprofile=coverage.txt -covermode=atomic -coverpkg=github.com/vingarcia/ksql ./... \;
|
||||
|
||||
# Run ksql root module tests:
|
||||
go test -coverprofile=coverage.txt -covermode=atomic -coverpkg=github.com/vingarcia/ksql ./...
|
||||
|
||||
# Run the tests for the examples module:
|
||||
( cd examples ; go test -coverprofile=coverage.txt -covermode=atomic -coverpkg=github.com/vingarcia/ksql ./... )
|
||||
|
||||
# Make sure the run-with-replace.sh is on PATH:
|
||||
export PATH=$PATH:$(pwd)/scripts
|
||||
|
||||
# Then for each adapter run the tests with the replace directive:
|
||||
for dir in $(find adapters -name go.mod -printf '%h\n'); do
|
||||
( cd $dir ; run-with-replace.sh go test -coverprofile=coverage.txt -covermode=atomic -coverpkg=github.com/vingarcia/ksql ./... )
|
||||
done
|
||||
|
||||
# codecov will find all `coverate.txt` files, so it will work fine.
|
||||
|
|
|
@ -0,0 +1,16 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
# Update go.mod with replace so testing will
|
||||
# run against the local version of ksql:
|
||||
echo "replace github.com/vingarcia/ksql => ../../" >> go.mod
|
||||
go mod tidy
|
||||
go test
|
||||
|
||||
# Save whether the tests succeeded or not:
|
||||
tests_succedeed=$?
|
||||
|
||||
# Undo the changes:
|
||||
git checkout go.mod go.sum > /dev/null
|
||||
|
||||
# Return error if the tests failed:
|
||||
test $tests_succedeed -eq 0
|
Loading…
Reference in New Issue