Skip to content

Commit

Permalink
Move all documentation examples to separate test files (#3055)
Browse files Browse the repository at this point in the history
* add initial framework examples

Signed-off-by: Joseph Brinkman <[email protected]>
Co-authored-by: Edward Liang <[email protected]>
  • Loading branch information
jbrinkman and edlng authored Feb 11, 2025
1 parent ad9774d commit 468150a
Show file tree
Hide file tree
Showing 21 changed files with 5,185 additions and 1,551 deletions.
20 changes: 17 additions & 3 deletions go/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ build-glide-client:
else \
strip --strip-unneeded target/release/libglide_rs.a; \
fi


build-glide-client-debug:
cargo build
Expand Down Expand Up @@ -83,14 +83,28 @@ format:
gofumpt -w .
golines -w --shorten-comments -m 127 .

# unit tests - skip complete IT suite (including MT)
# unit tests - skip complete IT suite (including MT), and examples
# due to a bug in go 1.20 and 1.21, we need to use -run flag to get -skip flag to work
unit-test:
mkdir -p reports
set -o pipefail; \
LD_LIBRARY_PATH=$(shell find . -name libglide_rs.a|grep -w release|tail -1|xargs dirname|xargs readlink -f):${LD_LIBRARY_PATH} \
go test -v -race ./... -skip TestGlideTestSuite $(if $(test-filter), -testify.m $(test-filter)) \
go test -v -race ./... -skip 'Example|TestGlideTestSuite' -run Test $(if $(test-filter), -run $(test-filter)) \
| tee >(go tool test2json -t -p github.com/valkey-io/valkey-glide/go/utils | go-test-report -o reports/unit-tests.html -t unit-test > /dev/null)

# example tests - skip complete IT suite (including MT)
example-test:
mkdir -p reports
set -o pipefail; \
../utils/cluster_manager.py start -p 6379 -r 0
../utils/cluster_manager.py start --cluster-mode -p 7001 7002 7003 7004 7005 7006
LD_LIBRARY_PATH=$(shell find . -name libglide_rs.a|grep -w release|tail -1|xargs dirname|xargs readlink -f):${LD_LIBRARY_PATH} \
go test -v -race ./... -skip Test $(if $(test-filter), -run $(test-filter)) \
| tee >(go tool test2json -t -p github.com/valkey-io/valkey-glide/go/api \
| go-test-report -o reports/example-tests.html -t example-test > /dev/null)

../utils/cluster_manager.py stop --prefix cluster

# integration tests - run subtask with skipping modules tests
integ-test: export TEST_FILTER = -skip TestGlideTestSuite/TestModule $(if $(test-filter), -testify.m $(test-filter))
integ-test: __it
Expand Down
Loading

0 comments on commit 468150a

Please sign in to comment.