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

Compliance tests for Reserve(seconds). #920

Merged
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
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
12 changes: 6 additions & 6 deletions build/includes/sdk.mk
Original file line number Diff line number Diff line change
Expand Up @@ -111,18 +111,18 @@ 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: TIMEOUT ?= 30
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)
-e "TEST=ready,allocate,setlabel,setannotation,gameserver,health,shutdown,watch" -e "TIMEOUT=$(TIMEOUT)" $(sidecar_tag)

# Run SDK conformance test, previously built, for a specific SDK_FOLDER
SECONDS ?= 30
run-sdk-conformance-no-build: ensure-agones-sdk-image
run-sdk-conformance-no-build: TIMEOUT ?= 30
run-sdk-conformance-no-build: TESTS ?= ready,allocate,setlabel,setannotation,gameserver,health,shutdown,watch
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)
-e "TEST=$(TESTS)" -e "TIMEOUT=$(TIMEOUT)" --net=host $(sidecar_tag)


# Run SDK conformance test for a specific SDK_FOLDER
Expand All @@ -134,5 +134,5 @@ run-sdk-conformance-test:
# Run a conformance test for all SDKs supported
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=go TESTS=ready,allocate,setlabel,setannotation,gameserver,health,shutdown,watch,reserve
roberthbailey marked this conversation as resolved.
Show resolved Hide resolved
$(MAKE) run-sdk-conformance-test SDK_FOLDER=rust
1 change: 1 addition & 0 deletions pkg/sdkserver/localsdk.go
Original file line number Diff line number Diff line change
Expand Up @@ -283,6 +283,7 @@ func (l *LocalSDKServer) WatchGameServer(_ *sdk.Empty, stream sdk.SDK_WatchGameS
// Reserve moves this GameServer to the Reserved state for the Duration specified
func (l *LocalSDKServer) Reserve(_ context.Context, d *sdk.Duration) (*sdk.Empty, error) {
logrus.WithField("duration", d).Info("Reserve request has been received!")
l.recordRequest("reserve")
return &sdk.Empty{}, nil
}

Expand Down
5 changes: 4 additions & 1 deletion test/sdk/go/sdk-client-test.go
Original file line number Diff line number Diff line change
Expand Up @@ -90,8 +90,11 @@ func main() {
if err != nil {
log.Fatalf("Could not set annotation: %s", err)
}
if err = sdk.Reserve(5 * time.Second); err != nil {
roberthbailey marked this conversation as resolved.
Show resolved Hide resolved
log.Fatalf("Could not send Reserve command: %s", err)
}
err = sdk.Shutdown()
if err != nil {
log.Fatalf("Could not shutdown GameServer%s", err)
log.Fatalf("Could not shutdown GameServer: %s", err)
}
}
16 changes: 16 additions & 0 deletions test/sdk/nodejs/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# Copyright 2019 Google LLC All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

node_modules/
package-lock.json