-
Notifications
You must be signed in to change notification settings - Fork 818
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
PoC for SDK conformance testing. Code generator should use code templates from sdk_client use testReady scenarios from harness folder and produce go file which would run the scenario.
- Loading branch information
Showing
12 changed files
with
588 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
# Copyright 2019 Google Inc. 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. | ||
FROM golang:latest | ||
|
||
RUN apt-get update && \ | ||
apt-get install -y wget jq && \ | ||
apt-get clean | ||
|
||
# install go | ||
WORKDIR /usr/local | ||
ENV GO_VERSION=1.12 | ||
ENV GO111MODULE=on | ||
ENV GOPATH /go | ||
RUN wget -q https://dl.google.com/go/go${GO_VERSION}.linux-amd64.tar.gz && \ | ||
tar -xzf go${GO_VERSION}.linux-amd64.tar.gz && rm go${GO_VERSION}.linux-amd64.tar.gz && mkdir -p ${GOPATH} | ||
|
||
WORKDIR /go/src/agones.dev/agones | ||
ENV PATH /usr/local/go/bin:/go/bin:$PATH | ||
|
||
RUN curl -sL https://deb.nodesource.com/setup_11.x | bash - && \ | ||
apt-get install -y nodejs | ||
|
||
# code generation scripts | ||
COPY *.sh /root/ | ||
RUN chmod +x /root/*.sh |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
#!/usr/bin/env bash | ||
|
||
# Copyright 2019 Google Inc. 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. | ||
set -ex | ||
|
||
cd /go/src/agones.dev/agones/test/sdk | ||
./sdk --test="" --sdk="nodejs" | ||
cd /go/src/agones.dev/agones/test/sdk/bin/nodejs | ||
npm install --cache /tmp/empty-cache | ||
npm rebuild | ||
|
||
cd /go/src/agones.dev/agones/test/sdk | ||
./sdk --verify=true --sdk nodejs |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
#!/usr/bin/env bash | ||
|
||
# Copyright 2019 Google Inc. 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. | ||
|
||
set -ex | ||
|
||
GO111MODULE=off | ||
cd /go/src/agones.dev/agones/cmd/sdk-server | ||
go build | ||
cd /go/src/agones.dev/agones/test/sdk | ||
rm -rf ./bin | ||
mkdir -p ./bin | ||
mv /go/src/agones.dev/agones/cmd/sdk-server/sdk-server ./bin | ||
go build |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
#!/usr/bin/env bash | ||
|
||
# Copyright 2019 Google Inc. 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. | ||
|
||
set -ex | ||
GO111MODULE=off | ||
|
||
cd /go/src/agones.dev/agones/test/sdk | ||
./sdk --test="" | ||
cd ./bin/golang/ | ||
dirs=($(find . -mindepth 1 -type d)) | ||
for dir in "${dirs[@]}"; do | ||
cd "$dir" | ||
go build | ||
echo $PWD | ||
cd - | ||
done | ||
cd /go/src/agones.dev/agones/test/sdk | ||
./sdk --verify=true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
# 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. | ||
|
||
steps: | ||
- init | ||
- ready | ||
- getGameServer | ||
- setlabel | ||
- setannotation | ||
- cleanup | ||
expected: | ||
- Ready | ||
- getting GameServer details | ||
- Setting label | ||
- Setting annotation |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
# 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. | ||
|
||
steps: | ||
- init | ||
- ready | ||
- health | ||
- shutdown | ||
- cleanup | ||
expected: | ||
- Ready | ||
- Health | ||
- Shutdown |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
# 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. | ||
|
||
steps: | ||
- init | ||
- ready | ||
- allocate | ||
- setlabel | ||
- setannotation | ||
- cleanup | ||
expected: | ||
- Ready | ||
- Allocate | ||
- Setting label | ||
- Setting annotation |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,78 @@ | ||
# 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. | ||
|
||
functions: | ||
health: | | ||
time.Sleep(1*time.Second) | ||
for i := 0 ; i < 5; i ++ { | ||
err = s.Health() | ||
if err != nil { | ||
log.Fatalf("Could not send Health check") | ||
} else { | ||
log.Println("Health message sent") | ||
} | ||
} | ||
ready: | | ||
err = s.Ready() | ||
if err != nil { | ||
log.Fatalf("Could not send ready message") | ||
} | ||
shutdown: | | ||
err = s.Shutdown() | ||
if err != nil { | ||
log.Fatalf("Could not send shutdown request") | ||
} | ||
getGameServer: | | ||
gs, err := s.GameServer() | ||
if err != nil { | ||
log.Fatalf("Could not get gameserver parameters") | ||
} | ||
log.Println(gs) | ||
allocate: | | ||
err = s.Allocate() | ||
if err != nil { | ||
log.Fatalf("Could not send allocate request") | ||
} | ||
setlabel: | | ||
err = s.SetLabel("new", "label") | ||
if err != nil { | ||
log.Fatalf("Could not set label") | ||
} | ||
setannotation: | | ||
err = s.SetAnnotation("new", "annotation") | ||
if err != nil { | ||
log.Fatalf("Could not set annotation") | ||
} | ||
init: | | ||
package main | ||
import ( | ||
"time" | ||
"log" | ||
sdk "agones.dev/agones/sdks/go" | ||
) | ||
func main() { | ||
log.Println("starting") | ||
time.Sleep(100 * time.Millisecond) | ||
s, err := sdk.NewSDK() | ||
if err != nil { | ||
log.Fatalf("Could not connect to sdk: %v", err) | ||
} else { | ||
log.Println("SDK initialised") | ||
} | ||
cleanup: | | ||
time.Sleep(3*time.Second) | ||
} |
Oops, something went wrong.