Skip to content

Commit

Permalink
Fix Rust SDK conformance flakiness, add clean step (#913)
Browse files Browse the repository at this point in the history
Add build and clean step even if we run tests not in a test suite, but
as a single test.
  • Loading branch information
aLekSer authored and markmandel committed Jul 18, 2019
1 parent 32a571c commit 8c80b9b
Show file tree
Hide file tree
Showing 6 changed files with 27 additions and 10 deletions.
10 changes: 10 additions & 0 deletions build/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -416,6 +416,16 @@ Build all the sdks required for Agones
#### `make build-sdk-cpp`
Build the cpp sdk static and dynamic libraries (linux libraries only)

#### `make run-sdk-conformance-local`
Run Agones sidecar which would wait for all requests from the SDK client.
Note that annotation should contain UID and label should contain CreationTimestamp values to pass the test.

#### `make run-sdk-conformance-no-build`
Only run a conformance test for a specific Agones SDK.

#### `make run-sdk-conformance-test`
Build, run and clean conformance test for a specific Agones SDK.

#### `make run-sdk-conformance-tests`
Run SDK conformance test.
Run SDK server (sidecar) in test mode (which would record all GRPC requests) versus all SDK test clients which should generate those requests. All methods are verified.
Expand Down
File renamed without changes.
File renamed without changes.
3 changes: 2 additions & 1 deletion build/build-sdk-images/rust/clean.sh
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,5 @@
set -ex
cd /go/src/agones.dev/agones/test/sdk/rust
cargo clean
rm -rf /go/src/agones.dev/agones/test/sdk/rust/target
rm /go/src/agones.dev/agones/test/sdk/rust/Cargo.lock
rm -rf /go/src/agones.dev/agones/test/sdk/rust/target
21 changes: 12 additions & 9 deletions build/includes/sdk.mk
Original file line number Diff line number Diff line change
Expand Up @@ -112,24 +112,27 @@ ensure-build-sdk-image:
# Run SDK conformance Sidecar server in docker in order to run
# SDK client test against it. Useful for test development
SECONDS ?= 30
run-sdk-conformance-local:
run-sdk-conformance-local: ensure-agones-sdk-image
docker run -e "ADDRESS=" -p 59357:59357 \
-e "TEST=ready,allocate,setlabel,setannotation,gameserver,health,shutdown,watch" -e "TIMEOUT=$(SECONDS)" $(sidecar_tag)

# Run SDK conformance test for a specific SDK_FOLDER
# Run SDK conformance test, previously built, for a specific SDK_FOLDER
SECONDS ?= 30
run-sdk-conformance-test: SDK_FOLDER=$(SDK_FOLDER)
run-sdk-conformance-test: ensure-build-sdk-image
run-sdk-conformance-no-build: ensure-agones-sdk-image
run-sdk-conformance-no-build: ensure-build-sdk-image
sleep 2s && DOCKER_RUN_ARGS="--network=host $(DOCKER_RUN_ARGS)" COMMAND=sdktest $(MAKE) run-sdk-command & \
docker run -p 59357:59357 -e "ADDRESS=" \
-e "TEST=ready,allocate,setlabel,setannotation,gameserver,health,shutdown,watch" -e "TIMEOUT=$(SECONDS)" --net=host $(sidecar_tag)


# Run SDK conformance test for a specific SDK_FOLDER
run-sdk-conformance-test:
$(MAKE) run-sdk-command COMMAND=build-sdk-test
$(MAKE) run-sdk-conformance-no-build
$(MAKE) run-sdk-command COMMAND=clean

# Run a conformance test for all SDKs supported
run-sdk-conformance-tests: ensure-agones-sdk-image
$(MAKE) run-sdk-command SDK_FOLDER=node COMMAND=build
$(MAKE) run-sdk-command SDK_FOLDER=rust COMMAND=build
run-sdk-conformance-tests:
$(MAKE) run-sdk-conformance-test SDK_FOLDER=node
$(MAKE) run-sdk-conformance-test SDK_FOLDER=go
$(MAKE) run-sdk-conformance-test SDK_FOLDER=rust
$(MAKE) run-sdk-command SDK_FOLDER=rust COMMAND=clean
$(MAKE) run-sdk-command SDK_FOLDER=node COMMAND=clean
3 changes: 3 additions & 0 deletions test/sdk/rust/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,9 @@ fn run() -> Result<(), String> {
});
}});

// Waiting for a thread to spawn
thread::sleep(Duration::from_secs(2));

println!("Marking server as ready...");
sdk.ready()
.map_err(|e| format!("Could not run Ready(): {}. Exiting!", e))?;
Expand Down

0 comments on commit 8c80b9b

Please sign in to comment.