Skip to content

chore(e2e): add e2e tests for sidecars#1011

Merged
mergify[bot] merged 3 commits intoaws:masterfrom
iamhopaul123:e2e/sidecars
Jun 11, 2020
Merged

chore(e2e): add e2e tests for sidecars#1011
mergify[bot] merged 3 commits intoaws:masterfrom
iamhopaul123:e2e/sidecars

Conversation

@iamhopaul123
Copy link
Copy Markdown
Contributor

Fixes #1008.

(I'm gonna rest in peace. Put the e2e test log on my grave and don't include any PR reviews other than LGTM)

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

Copy link
Copy Markdown
Contributor

@kohidave kohidave left a comment

Choose a reason for hiding this comment

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

This looks so delightful! Thank you :)

Comment thread e2e/e2e.sh Outdated
@@ -0,0 +1,42 @@
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Might be nice to have an AwsCLI struct, like we have for the CopilotCLI

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

👍

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Maybe it's not a good idea since the reason why we have a struct for copilot is because of mocking.

Comment thread e2e/sidecars/sidecars_test.go Outdated
Comment on lines +157 to +174
It("create new ECR repo for sidecar", func() {
var b bytes.Buffer
err := command.Run("bash", []string{"-c", fmt.Sprintf("aws ecr create-repository --repository-name %s | jq -r .repository.repositoryUri", sidecarRepoName)}, command.Stdout(&b))
Expect(err).NotTo(HaveOccurred(), "create ECR repo for sidecar")
uri = strings.TrimSpace(b.String())
sidecarImageURI = fmt.Sprintf("%s:%s", uri, tag)
})
It("push sidecar image", func() {
var b bytes.Buffer
err := command.Run("aws", []string{"ecr", "get-login-password"}, command.Stdout(&b))
password := b.String()
Expect(err).NotTo(HaveOccurred(), "get ecr login password")
err = command.Run("docker", []string{"login", "-u", "AWS", "--password-stdin", uri}, command.Stdin(strings.NewReader(password)))
Expect(err).NotTo(HaveOccurred(), "docker login")
err = command.Run("docker", []string{"build", "-t", sidecarImageURI, "./nginx"})
Expect(err).NotTo(HaveOccurred(), "build sidecar image")
err = command.Run("docker", []string{"push", sidecarImageURI})
Expect(err).NotTo(HaveOccurred(), "push to ECR repo")
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Do you think this should be a BeforeAll of the 'write manifest file' section?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Yeah that's a good idea!

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

i tried to use BeforeAll but it seems like inside of beforeAll it doesn't allow me to have multiple It(). so i'll leave it as it is now.

Comment thread e2e/sidecars/sidecars_test.go Outdated
Copy link
Copy Markdown
Contributor

@efekarakus efekarakus left a comment

Choose a reason for hiding this comment

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

Looks really good!

const lorem = require('lorem-ipsum')

// Log requests
app.use(function *(next){
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Wow it's the first time that I see the generator syntax in JS! :O

Comment thread e2e/sidecars/sidecars_test.go Outdated
Comment thread e2e/sidecars/sidecars_test.go Outdated
Comment thread e2e/sidecars/sidecars_test.go
Comment thread e2e/sidecars/sidecars_test.go Outdated
Comment thread e2e/sidecars/sidecars_test.go Outdated

for _, logLine := range svcLogs {
Expect(logLine.Message).NotTo(Equal(""))
Expect(logLine.LogStreamName).NotTo(Equal(""))
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

maybe we can validate that the logstreamname is the custom one that firelens set for us?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

But the thing is it contains not only the logs from firelens but also nginx logs and the logs for firelens itself...

Copy link
Copy Markdown
Contributor Author

@iamhopaul123 iamhopaul123 Jun 11, 2020

Choose a reason for hiding this comment

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

maybe i can try to check if the log stream name falls into these three options. But still we don't know the full name for the log streams unless we query it.

@mergify mergify bot merged commit 165c106 into aws:master Jun 11, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Sidecars e2e tests

4 participants