-
Notifications
You must be signed in to change notification settings - Fork 74
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
Tests/modes #88
Tests/modes #88
Conversation
1fd689d
to
5db8006
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- Couple of go issues.
- Tweak count values of the specification (before creating deployment)
tests/modes_test.go
Outdated
// check environment | ||
longOrSkip(t) | ||
|
||
// FIXME - add code |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
TODO?
tests/modes_test.go
Outdated
@@ -0,0 +1,108 @@ | |||
// |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm confused by the filename.
This is about environments, not modes.
tests/modes_test.go
Outdated
subTest(t, api.DeploymentModeCluster, api.StorageEngineRocksDB) | ||
} | ||
|
||
func subTest(t *testing.T, mode api.DeploymentMode, engine api.StorageEngine) error { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please use a more descriptive function name
subTest
can apply to any test
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
and document it
tests/modes_test.go
Outdated
deploymentTemplate.Spec.Environment = api.NewEnvironment(api.EnvironmentProduction) | ||
deploymentTemplate.Spec.SetDefaults(deploymentTemplate.GetName()) // this must be last | ||
|
||
var dbserverCount int = *deploymentTemplate.Spec.DBServers.Count |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
go: dbserverCount := *deploymentTemplate.Spec.DBServers.Count
tests/modes_test.go
Outdated
|
||
numNodes := len((*nodeList).Items) | ||
|
||
var failExpected bool = false |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
go: failExpected := false
tests/modes_test.go
Outdated
t.Fatalf("Unable to receive node list: %v", err) | ||
} | ||
|
||
numNodes := len((*nodeList).Items) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
go: numNodes := len(nodeList.Items)
.
will de-reference on its own.
tests/modes_test.go
Outdated
} | ||
|
||
// Create deployment | ||
deployment, err := deploymentClient.DatabaseV1alpha().ArangoDeployments(k8sNameSpace).Create(deploymentTemplate) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
deployment
is never used, so you can replace this with
if _, err := deploymentClient.DatabaseV1alpha().ArangoDeployments(k8sNameSpace).Create(deploymentTemplate); err != nil { ...
tests/modes_test.go
Outdated
t.Fatalf("Create deployment failed: %v", err) | ||
} | ||
|
||
deployment, err = waitUntilDeployment(deploymentClient, deploymentTemplate.GetName(), k8sNameSpace, deploymentIsReady()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
After above change, this will be the first use of deployment
, so deployment, err := ...
tests/modes_test.go
Outdated
deploymentTemplate.Spec.StorageEngine = api.NewStorageEngine(engine) | ||
deploymentTemplate.Spec.TLS = api.TLSSpec{} // should auto-generate cert | ||
deploymentTemplate.Spec.Environment = api.NewEnvironment(api.EnvironmentProduction) | ||
deploymentTemplate.Spec.SetDefaults(deploymentTemplate.GetName()) // this must be last |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I expected the spec to set Count values above the number of nodes.
That way we can also test what happens when you have a 3 node cluster with 4 dbservers/agents/coordinators.
tests/modes_test.go
Outdated
deploymentTemplate.Spec.Mode = api.NewMode(mode) | ||
deploymentTemplate.Spec.StorageEngine = api.NewStorageEngine(engine) | ||
deploymentTemplate.Spec.TLS = api.TLSSpec{} // should auto-generate cert | ||
deploymentTemplate.Spec.Environment = api.NewEnvironment(api.EnvironmentProduction) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You must specify an Image
in production mode.
Added validation of spec to ensure that is all good. [ci LONG=1] [ci TESTOPTIONS="-test.run ^TestProduction$"]
Couple of go issues remain, but let's merge it now. |
[ci LONG=1] [ci TESTOPTIONS="-test.run ^TestProduction$"]
Test if deployments work in development and production mode