-
Notifications
You must be signed in to change notification settings - Fork 828
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Flaky TestGameServerAllocationDeletionOnUnAllocate
Realised that Go test will compile and run tests in parallel per file, which means we could shutdown the controller while an allocation is in process - which means, it will fail completely, as the Kubernetes API cannot reach the controller's http endpoint for allocation. Split the controller tests into a separate package which could be run with -parallel=1 so that there can be no race condition. Also did some grouping of e2e test functionality to reduce code repetition. Closes #1326
- Loading branch information
1 parent
bb05ab0
commit 569daf4
Showing
6 changed files
with
184 additions
and
33 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
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,17 @@ | ||
// Copyright 2020 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. | ||
|
||
// Package controller is for testing controller failures. | ||
// *** Under no circumstance should these tests be made t.Parallel()! *** | ||
package controller |
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,61 @@ | ||
// Copyright 2020 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. | ||
|
||
package controller | ||
|
||
import ( | ||
"log" | ||
"os" | ||
"testing" | ||
|
||
e2eframework "agones.dev/agones/test/e2e/framework" | ||
"github.com/sirupsen/logrus" | ||
) | ||
|
||
const defaultNs = "default" | ||
|
||
var framework *e2eframework.Framework | ||
|
||
func TestMain(m *testing.M) { | ||
logrus.SetFormatter(&logrus.TextFormatter{ | ||
EnvironmentOverrideColors: true, | ||
FullTimestamp: true, | ||
TimestampFormat: "2006-01-02 15:04:05.000", | ||
}) | ||
|
||
var ( | ||
err error | ||
exitCode int | ||
) | ||
|
||
if framework, err = e2eframework.NewFromFlags(); err != nil { | ||
log.Printf("failed to setup framework: %v\n", err) | ||
os.Exit(1) | ||
} | ||
|
||
// run cleanup before tests, to ensure no resources from previous runs exist. | ||
err = framework.CleanUp(defaultNs) | ||
if err != nil { | ||
log.Printf("failed to cleanup resources: %v\n", err) | ||
} | ||
|
||
defer func() { | ||
err = framework.CleanUp(defaultNs) | ||
if err != nil { | ||
log.Printf("failed to cleanup resources: %v\n", err) | ||
} | ||
os.Exit(exitCode) | ||
}() | ||
exitCode = m.Run() | ||
} |
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