Skip to content
This repository has been archived by the owner on Dec 1, 2022. It is now read-only.

Automate the setup of DS Integ and E2E tests #186

Merged
merged 7 commits into from Mar 15, 2017
Merged

Conversation

tuedtran
Copy link
Contributor

Summary

Automate the setup of DS Integ and E2E tests
#184

Implementation details

Automate the setup of the environment for the CSS E2E test

Testing

  • cluster-state-service binary built locally and unit-tests pass (cd cluster-state-service; make; cd ../)
  • cluster-state-service build in Docker succeeds (cd cluster-state-service; make release; cd ../)
  • daemon-scheduler binary built locally and unit-tests pass (cd daemon-scheduler; make; cd ../)
  • daemon-scheduler build in Docker succeeds (cd daemon-scheduler; make release; cd ../)

New tests cover the changes: no

Description for the changelog

Automate the setup of the environment for the CSS E2E test

Licensing

This contribution is under the terms of the Apache 2.0 License: Yes

Before merging

  • cluster-state-service end-to-end tests pass. Required setup details are listed here.
  • daemon-scheduler integration tests pass. Required setup details are listed here.
  • daemon-scheduler end-to-end tests pass. Required setup details are listed here.

os.Exit(errorCode)
}

taskDefinitionSleep300 := "esh_test_sleep300"
Copy link
Contributor

Choose a reason for hiding this comment

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

I see you're registering an esh_test_sleep300 task definition, but where are you using it?

Copy link
Contributor

Choose a reason for hiding this comment

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

If you're actually using it, can you rename this to ds_test_sleep300?

@@ -38,11 +46,18 @@ const (
invalidCluster = "cluster/cluster"
badRequestHTTPResponse = "400 Bad Request"
listEnvironmentsBadRequest = "ListEnvironmentsBadRequest"

errorCode = 1
configName = "DSASGLaunchConfiguration"
Copy link
Contributor

@kylbarnes kylbarnes Mar 14, 2017

Choose a reason for hiding this comment

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

This is a little ambiguous. Can you rename this variable to launchConfigurationName?

}

err = asgWrapper.CreateLaunchConfiguration(configName, clusterName, instanceProfileName, keyPair, amiID)
if err != nil {
Copy link
Contributor

Choose a reason for hiding this comment

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

What if it's not an awserr.Error?

}

err = asgWrapper.CreateAutoScalingGroup(asg, configName, azs)
if err != nil {
Copy link
Contributor

Choose a reason for hiding this comment

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

Same comment as above.

os.Exit(errorCode)
}

taskDefinitionSleep300 := "esh_test_sleep300"
Copy link
Contributor

Choose a reason for hiding this comment

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

If you're actually using it, can you rename this to ds_test_sleep300?

}

asg := wrappers.GetASGName()
if asg == defaultASGClusterName {
Copy link
Contributor

Choose a reason for hiding this comment

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

What is this for? What if the asg name is different?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

If users wanna pass in their custom ASG, the test will pick up that ASG and not create a new ASG itself.

Copy link
Contributor

Choose a reason for hiding this comment

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

Should we validate the user-given ASG?


func (wrapper AutoScalingWrapper) CreateLaunchConfiguration(configName string, clusterName string, instanceProfileName string, keyName string, amiID string) error {
// The user data is run when the instance is launched. It registers the instance to the cluster
// and makes the instance to self-terminate after one hour in case the test fails to clean up.
Copy link
Contributor

Choose a reason for hiding this comment

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

Does self-terminate actually work? If not, might make sense to point out that the instance state is set to stopped (and that it does not actually terminate).

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sure. I will add a comment here and in the Readme as well.

- Create ECS cluster (e.g. name=q-daemon-scheduler-test)
- Create AutoScaling group (e.g. name=ecs-daemon-scheduler-test-asg) which can launch instances into the above ECS cluster. Follow the steps [here](http://docs.aws.amazon.com/AmazonECS/latest/developerguide/launch_container_instance.html)
- Start blox cluster state service:
AWS_PROFILE=default AWS_REGION=us-west-2 CSS_LOG_FILE=var/output/logs/css.log ./out/cluster-state-service --queue event_stream --etcd-endpoint localhost:2379 --bind localhost:3000
Copy link
Contributor

Choose a reason for hiding this comment

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

Can you wrap these two commands into ``` blocks similar to the gucumber ones down below?

AWS_REGION=... AWS_PROFILE=... gucumber -tags=@integ
```

- Customization
Copy link
Contributor

Choose a reason for hiding this comment

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

Can you prefix this line with a # instead of a - to make it a header?


- Customization
Users can pass in their own cluster, autoscaling group, or EC2 key pair to the tests
Custom names have to be different from default names:
Copy link
Contributor

Choose a reason for hiding this comment

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

Can you format the options below as a list by prefixing them with *?

}

var status string
if resp.AutoScalingGroups[0].Status != nil {
Copy link
Contributor

Choose a reason for hiding this comment

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

What will happen if resp.AutoScalingGroups has a length of 0? My guess is it will nil pointer panic here.

os.Exit(errorCode)
}

asg := wrappers.GetASGName()
Copy link
Contributor

Choose a reason for hiding this comment

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

Can you change this to asg = instead of asg :=? This is creating a new local variable instead of using the variable defined above.

forceDelete := true
// With ForceDelete set to true, this will delete all instances attached to the Autoscaling group
asgWrapper.DeleteAutoScalingGroup(asg, forceDelete)
if err != nil {
Copy link
Contributor

Choose a reason for hiding this comment

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

What err are you checking here?

}

asgWrapper.DeleteLaunchConfiguration(launchConfigurationName)
if err != nil {
Copy link
Contributor

Choose a reason for hiding this comment

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

What err are you checking here?

Copy link
Contributor

@kylbarnes kylbarnes left a comment

Choose a reason for hiding this comment

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

Looks good. Verified running the daemon-scheduler e2e and integration tests.

@tuedtran tuedtran merged commit 2dbc280 into blox:dev Mar 15, 2017
@tuedtran tuedtran deleted the ds-autotest branch March 15, 2017 17:56
@kylbarnes kylbarnes mentioned this pull request Mar 15, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants