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

Add a simple helm test #1449

Merged
merged 3 commits into from
Apr 24, 2020
Merged

Add a simple helm test #1449

merged 3 commits into from
Apr 24, 2020

Conversation

aLekSer
Copy link
Collaborator

@aLekSer aLekSer commented Apr 4, 2020

This could be useful for Terraform configs check that installation
was completed, for example after switching to a new cluster.

Run helm test agones --cleanup to verify the deployment.

@aLekSer
Copy link
Collaborator Author

aLekSer commented Apr 4, 2020

In Helm 3 there is an ability to use Batch Job instead of Pod in test-runner.yaml.
There would be great to have an option to run CRD manifest as helm test:

apiVersion: "agones.dev/v1"
kind: GameServer

We can add {{- if .Values.tests.enabled }} parameter as in this example https://github.com/hashicorp/consul-helm/blob/master/templates/tests/test-runner.yaml

An example of a failed run (for example ImagePullBackoff on Agones Controller when used wrong imageTag):

helm test agones --cleanup
RUNNING: agones-test-h5ulc
FAILED: agones-test-h5ulc, run `kubectl logs agones-test-h5ulc --namespace agones-system` for more info                                                                                                    
Error: 1 test(s) failed

Successful run:

helm test agones --cleanup
RUNNING: agones-test-uy3de
PASSED: agones-test-uy3de

@agones-bot
Copy link
Collaborator

Build Failed 😱

Build Id: 4c9454d0-19e1-4358-913d-9ce173188565

To get permission to view the Cloud Build view, join the agones-discuss Google Group.

@aLekSer
Copy link
Collaborator Author

aLekSer commented Apr 4, 2020

Build has failed because of absence of the image at the gcr.io/agones-images registry.

@agones-bot
Copy link
Collaborator

Build Failed 😱

Build Id: e614dd81-c296-408c-8e2f-a91899f954b2

To get permission to view the Cloud Build view, join the agones-discuss Google Group.

@agones-bot
Copy link
Collaborator

Build Failed 😱

Build Id: 51288b8b-a733-483b-9b35-8f1dc58fd868

To get permission to view the Cloud Build view, join the agones-discuss Google Group.

@agones-bot
Copy link
Collaborator

Build Failed 😱

Build Id: 270569e7-a5d1-4a0c-ab60-4fbf3f3afe75

To get permission to view the Cloud Build view, join the agones-discuss Google Group.

@agones-bot
Copy link
Collaborator

Build Succeeded 👏

Build Id: 8bec4e28-ea07-4bd2-bca5-a63a76c37614

The following development artifacts have been built, and will exist for the next 30 days:

A preview of the website (the last 30 builds are retained):

To install this version:

  • git fetch https://github.com/GoogleCloudPlatform/agones.git pull/1449/head:pr_1449 && git checkout pr_1449
  • helm install ./install/helm/agones --namespace agones-system --name agones --set agones.image.tag=1.5.0-fe1901e

Copy link
Member

@markmandel markmandel left a comment

Choose a reason for hiding this comment

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

LGTM, but probably should have some accompanying documentation? Probably in the Helm Installation section?

examples/crd-client/main.go Show resolved Hide resolved
@markmandel markmandel added area/operations Installation, updating, metrics etc feature-freeze-do-not-merge Only eligible to be merged once we are out of feature freeze (next full release) kind/feature New features for Agones labels Apr 9, 2020
@aLekSer
Copy link
Collaborator Author

aLekSer commented Apr 9, 2020

Yes, I will add this to the documentation.

@markmandel markmandel removed the feature-freeze-do-not-merge Only eligible to be merged once we are out of feature freeze (next full release) label Apr 14, 2020
@markmandel
Copy link
Member

Gentle bump to add documentation.

@agones-bot
Copy link
Collaborator

Build Succeeded 👏

Build Id: 6ec4292c-a58b-49fa-85cf-5bc0ea4a6b80

The following development artifacts have been built, and will exist for the next 30 days:

A preview of the website (the last 30 builds are retained):

To install this version:

  • git fetch https://github.com/GoogleCloudPlatform/agones.git pull/1449/head:pr_1449 && git checkout pr_1449
  • helm install ./install/helm/agones --namespace agones-system --name agones --set agones.image.tag=1.6.0-a8891d7

@agones-bot
Copy link
Collaborator

Build Succeeded 👏

Build Id: f700f771-8996-48a1-a680-46c2239da7f7

The following development artifacts have been built, and will exist for the next 30 days:

A preview of the website (the last 30 builds are retained):

To install this version:

  • git fetch https://github.com/GoogleCloudPlatform/agones.git pull/1449/head:pr_1449 && git checkout pr_1449
  • helm install ./install/helm/agones --namespace agones-system --name agones --set agones.image.tag=1.6.0-21d38e7

fmt.Printf("New game servers' name is: %s", newGS.ObjectMeta.Name)
if viper.GetBool(isHelmTest) {
time.Sleep(1 * time.Second)
err = agonesClient.AgonesV1().GameServers(defaultNs).Delete(newGS.ObjectMeta.Name, nil) // nolint: errcheck
Copy link
Contributor

Choose a reason for hiding this comment

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

remove // nolint: errcheck

time.Sleep(1 * time.Second)
err = agonesClient.AgonesV1().GameServers(defaultNs).Delete(newGS.ObjectMeta.Name, nil) // nolint: errcheck
if err != nil {
panic(err)
Copy link
Contributor

Choose a reason for hiding this comment

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

It is better to use panic from logrus here and above

viper.SetDefault(gameServerImage, defaultImage)
runtime.Must(viper.BindEnv(gameServerImage))
viper.GetString(gameServerImage)

pflag.Bool(isHelmTest, false, "Is helm test - shutdown GameServer at the end of test. Defaults to false")
Copy link
Contributor

Choose a reason for hiding this comment

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

Can we rephrase - "Defines whether GameServer should be shut down at the end of the test or not"?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

added your definition.

@aLekSer
Copy link
Collaborator Author

aLekSer commented Apr 22, 2020

Fail in C# SDK conformance test:


/usr/share/dotnet/sdk/2.2.402/Sdks/Microsoft.NET.Sdk/targets/Microsoft.NET.Sdk.targets(129,5): error MSB4018: The "GenerateDepsFile" task failed unexpectedly. [/go/src/agones.dev/agones/sdks/csharp/sdk/csharp-sdk.csproj]
/usr/share/dotnet/sdk/2.2.402/Sdks/Microsoft.NET.Sdk/targets/Microsoft.NET.Sdk.targets(129,5): error MSB4018: System.IO.IOException: The process cannot access the file '/go/src/agones.dev/agones/sdks/csharp/sdk/bin/Release/netstandard2.0/AgonesSDK.deps.json' because it is being used by another process. [/go/src/agones.dev/agones/sdks/csharp/sdk/csharp-sdk.csproj]
/usr/share/dotnet/sdk/2.2.402/Sdks/Microsoft.NET.Sdk/targets/Microsoft.NET.Sdk.targets(129,5): error MSB4018:    at System.IO.FileStream.Init(FileMode mode, FileShare share) [/go/src/agones.dev/agones/sdks/csharp/sdk/csharp-sdk.csproj]
/usr/share/dotnet/sdk/2.2.402/Sdks/Microsoft.NET.Sdk/targets/Microsoft.NET.Sdk.targets(129,5): error MSB4018:    at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize, FileOptions options) [/go/src/agones.dev/agones/sdks/csharp/sdk/csharp-sdk.csproj]
/usr/share/dotnet/sdk/2.2.402/Sdks/Microsoft.NET.Sdk/targets/Microsoft.NET.Sdk.targets(129,5): error MSB4018:    at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize) [/go/src/agones.dev/agones/sdks/csharp/sdk/csharp-sdk.csproj]
/usr/share/dotnet/sdk/2.2.402/Sdks/Microsoft.NET.Sdk/targets/Microsoft.NET.Sdk.targets(129,5): error MSB4018:    at System.IO.File.Create(String path) [/go/src/agones.dev/agones/sdks/csharp/sdk/csharp-sdk.csproj]
/usr/share/dotnet/sdk/2.2.402/Sdks/Microsoft.NET.Sdk/targets/Microsoft.NET.Sdk.targets(129,5): error MSB4018:    at Microsoft.NET.Build.Tasks.GenerateDepsFile.ExecuteCore() [/go/src/agones.dev/agones/sdks/csharp/sdk/csharp-sdk.csproj]
/usr/share/dotnet/sdk/2.2.402/Sdks/Microsoft.NET.Sdk/targets/Microsoft.NET.Sdk.targets(129,5): error MSB4018:    at Microsoft.NET.Build.Tasks.TaskBase.Execute() [/go/src/agones.dev/agones/sdks/csharp/sdk/csharp-sdk.csproj]
/usr/share/dotnet/sdk/2.2.402/Sdks/Microsoft.NET.Sdk/targets/Microsoft.NET.Sdk.targets(129,5): error MSB4018:    at Microsoft.Build.BackEnd.TaskExecutionHost.Microsoft.Build.BackEnd.ITaskExecutionHost.Execute() [/go/src/agones.dev/agones/sdks/csharp/sdk/csharp-sdk.csproj]
/usr/share/dotnet/sdk/2.2.402/Sdks/Microsoft.NET.Sdk/targets/Microsoft.NET.Sdk.targets(129,5): error MSB4018:    at Microsoft.Build.BackEnd.TaskBuilder.ExecuteInstantiatedTask(ITaskExecutionHost taskExecutionHost, TaskLoggingContext taskLoggingContext, TaskHost taskHost, ItemBucket bucket, TaskExecutionMode howToExecuteTask) [/go/src/agones.dev/agones/sdks/csharp/sdk/csharp-sdk.csproj]
includes/sdk.mk:89: recipe for target 'run-sdk-command' failed
make[1]: *** [run-sdk-command] Error 1
includes/sdk.mk:85: recipe for target 'run-sdk-command-csharp' failed

@aLekSer aLekSer force-pushed the helm-test branch 2 times, most recently from d025a61 to 308cb54 Compare April 22, 2020 17:08
@agones-bot
Copy link
Collaborator

Build Succeeded 👏

Build Id: 3bc82ec1-3569-4043-bf18-c096e606d567

The following development artifacts have been built, and will exist for the next 30 days:

A preview of the website (the last 30 builds are retained):

To install this version:

  • git fetch https://github.com/GoogleCloudPlatform/agones.git pull/1449/head:pr_1449 && git checkout pr_1449
  • helm install ./install/helm/agones --namespace agones-system --name agones --set agones.image.tag=1.6.0-d025a61

@agones-bot
Copy link
Collaborator

Build Succeeded 👏

Build Id: dc3f378e-ff2a-4f55-ae36-7008b4e15f52

The following development artifacts have been built, and will exist for the next 30 days:

A preview of the website (the last 30 builds are retained):

To install this version:

  • git fetch https://github.com/GoogleCloudPlatform/agones.git pull/1449/head:pr_1449 && git checkout pr_1449
  • helm install ./install/helm/agones --namespace agones-system --name agones --set agones.image.tag=1.6.0-308cb54

Copy link
Member

@markmandel markmandel left a comment

Choose a reason for hiding this comment

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

Overall nice addition, just one thing to fixup I think.

gameServerImage = "GAMESERVER_IMAGE"
gameServerImage = "GAMESERVER_IMAGE"
isHelmTest = "IS_HELM_TEST"
gameserversNamespace = "GAMESERVERS_NAMESPACE"

defaultImage = "gcr.io/agones-images/udp-server:0.19"
Copy link
Member

Choose a reason for hiding this comment

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

What was the motivation for hardcoding the image here? You were getting it as an environment variable, and it looks like you are still passing it in from the yaml below.

Seems like an env/arg value would be more flexible long term?

Copy link
Member

@markmandel markmandel left a comment

Choose a reason for hiding this comment

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

Sorry, that was meant to be a comment, not an approval

This could be useful for Terraform configs check that installation
was completed, for example after switching to a new cluster.
Described `helm test` command. Updated `crd-client` docs and version in
yaml of example Job which creates a GameServer and also used by the test.
Bump version of Agones in go.mod.
@agones-bot
Copy link
Collaborator

Build Succeeded 👏

Build Id: c5ff164d-c7e0-4869-addf-2a90ef25fa77

The following development artifacts have been built, and will exist for the next 30 days:

A preview of the website (the last 30 builds are retained):

To install this version:

  • git fetch https://github.com/GoogleCloudPlatform/agones.git pull/1449/head:pr_1449 && git checkout pr_1449
  • helm install ./install/helm/agones --namespace agones-system --name agones --set agones.image.tag=1.6.0-196fbd5

@agones-bot
Copy link
Collaborator

Build Succeeded 👏

Build Id: 5bc3e8e5-e14a-4fdf-9898-41807252e931

The following development artifacts have been built, and will exist for the next 30 days:

A preview of the website (the last 30 builds are retained):

To install this version:

  • git fetch https://github.com/GoogleCloudPlatform/agones.git pull/1449/head:pr_1449 && git checkout pr_1449
  • helm install ./install/helm/agones --namespace agones-system --name agones --set agones.image.tag=1.6.0-f275fa4

Copy link
Member

@markmandel markmandel left a comment

Choose a reason for hiding this comment

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

Nice!

@google-oss-robot
Copy link

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: akremsa, aLekSer, markmandel

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@google-oss-robot
Copy link

New changes are detected. LGTM label has been removed.

@agones-bot
Copy link
Collaborator

Build Succeeded 👏

Build Id: 908f4e44-1e46-4e6b-a4e0-824ffb365f80

The following development artifacts have been built, and will exist for the next 30 days:

A preview of the website (the last 30 builds are retained):

To install this version:

  • git fetch https://github.com/GoogleCloudPlatform/agones.git pull/1449/head:pr_1449 && git checkout pr_1449
  • helm install ./install/helm/agones --namespace agones-system --name agones --set agones.image.tag=1.6.0-5fa6d70

@markmandel markmandel merged commit 4ebd3b0 into googleforgames:master Apr 24, 2020
@markmandel markmandel added this to the 1.6.0 milestone Apr 24, 2020
ilkercelikyilmaz pushed a commit to ilkercelikyilmaz/agones that referenced this pull request Oct 23, 2020
* Add a simple helm test

This could be useful for Terraform configs check that installation
was completed, for example after switching to a new cluster.

* Add docs, import cleanup.

Described `helm test` command. Updated `crd-client` docs and version in
yaml of example Job which creates a GameServer and also used by the test.
Bump version of Agones in go.mod.

Co-authored-by: Mark Mandel <[email protected]>
ilkercelikyilmaz pushed a commit to ilkercelikyilmaz/agones that referenced this pull request Oct 23, 2020
* Add a simple helm test

This could be useful for Terraform configs check that installation
was completed, for example after switching to a new cluster.

* Add docs, import cleanup.

Described `helm test` command. Updated `crd-client` docs and version in
yaml of example Job which creates a GameServer and also used by the test.
Bump version of Agones in go.mod.

Co-authored-by: Mark Mandel <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved area/operations Installation, updating, metrics etc kind/feature New features for Agones size/L
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants