Skip to content
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

Move all documentation examples to separate test files #3055

Merged
merged 36 commits into from
Feb 11, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
6af0e93
add initial framework examples
jbrinkman Jan 27, 2025
3f02f1b
fix naming
jbrinkman Jan 27, 2025
2d9e9cd
add string commands examples
jbrinkman Jan 27, 2025
b5f9d4c
started a new cleaner branch and added commands
edlng Jan 27, 2025
7e98df2
create examples for string commands
jbrinkman Jan 29, 2025
86f03a6
interim save for stream commands tests
jbrinkman Jan 30, 2025
e8d5a6a
Added sorted set command examples
edlng Jan 30, 2025
2577435
Removed leftover example comments in BaseClient and GlideClient
edlng Jan 30, 2025
d793226
interim save for stream commands tests
jbrinkman Jan 31, 2025
176c1a9
interim save for stream commands tests - revert go.mod changes and fi…
jbrinkman Jan 31, 2025
44876aa
finish stream and set examples
jbrinkman Feb 3, 2025
1db0739
cleanup base client to remove examples
jbrinkman Feb 3, 2025
a95b79c
cleanup rebase issues
jbrinkman Feb 4, 2025
62ad3c9
move examples for BZMPop
jbrinkman Feb 4, 2025
e578845
fix linting errors due to formatting problems
jbrinkman Feb 4, 2025
daab272
split unit-tests and example-tests in makefile
jbrinkman Feb 6, 2025
2a8c5ee
remove hardcoded references to localhost and port 6379
jbrinkman Feb 6, 2025
79c7d29
fix build error
jbrinkman Feb 6, 2025
e03fd97
update unit-test make task to work in go 1.20
jbrinkman Feb 7, 2025
39f7397
fix linting errors due to formatting problems
jbrinkman Feb 7, 2025
e8ac07b
fix makefile for unit-test and example-tests to use test-filter
jbrinkman Feb 7, 2025
b0345eb
add copyright statement in example files
jbrinkman Feb 8, 2025
730addf
Fixed failing tests and added automation in Makefile
edlng Feb 6, 2025
3c76ad5
Fixed crashing examples test
edlng Feb 7, 2025
ad951a4
change cluster ports - port 7000 is used by MacOS control center
jbrinkman Feb 10, 2025
6291226
fix api package reference
jbrinkman Feb 10, 2025
3db97f3
fix formatting
jbrinkman Feb 10, 2025
a449c8b
fix makefile for running examples
jbrinkman Feb 10, 2025
c356af8
fix generic command examples
jbrinkman Feb 10, 2025
0d3972d
Update go/api/base_client.go
jbrinkman Feb 10, 2025
f93896e
Update go/api/base_client.go
jbrinkman Feb 10, 2025
55174ce
Update go/api/base_client.go
jbrinkman Feb 10, 2025
9de7806
Update go/api/base_client.go
jbrinkman Feb 10, 2025
d092526
fix more format/lint problems
jbrinkman Feb 10, 2025
da6b439
replace use of testify with go-cmp in examples
jbrinkman Feb 11, 2025
335dc93
remove use of go-cmp which seems to have issues
jbrinkman Feb 11, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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:
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Consider updating developer guide

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
Comment on lines +99 to +100
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Try to randomise ports to avoid collision

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
Loading