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

Log driver secret support functional test #1952

Merged
merged 1 commit into from
Mar 27, 2019

Conversation

tommyhahn
Copy link
Contributor

@tommyhahn tommyhahn commented Mar 20, 2019

Summary

Log driver secret support functional test using awslogs' multiline-pattern option.

Implementation details

Testing

New tests cover the changes:

Description for the changelog

Licensing

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

@yumex93
Copy link
Contributor

yumex93 commented Mar 21, 2019

Why this pr is overlapped with #1875 ? Can you remove #1875 and link the pr that is already approved to this one?

@tommyhahn
Copy link
Contributor Author

Here is the link to the approved PR for the code change:
Add log driver secret to LogConfig and agent capability #1818

@tommyhahn tommyhahn force-pushed the logDriver_funcTests branch from 35538f5 to efb8e11 Compare March 22, 2019 22:07
Copy link
Contributor

@suneyz suneyz left a comment

Choose a reason for hiding this comment

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

can you check why tests are all failing? Also pleas update your commit message to reflect your change for ecs model.

// create parameter in parameter store if it does not exist
_, err = ssmClient.PutParameter(input)
if err != nil {
if aerr, ok := err.(awserr.Error); ok {
Copy link
Contributor

Choose a reason for hiding this comment

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

You can prob change to this:

if aerr, ok := err.(awserr.Error); ok && aerr.Code() == ssm.ErrCodeParameterAlreadyExists {
 your logic goes here
}

]
}
}]
}
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: miss a newline

t.Logf("Parameter %v already exists in SSM Parameter Store", parameterName)
break
default:
require.NoError(t, err, "SSM PutParameter call failed")
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 use t.Errorf instead to make the logic clear that it will error if execute to this line. since you already check that err != nil

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Since this block of code resides in several test cases being involved in creating parameter in parameter store if not exist, I will leave this for now and try to optimize it all together later on.

defer os.Unsetenv("ECS_FTEST_FORCE_NET_HOST")

agent := RunAgent(t, &agentOptions)

Copy link
Contributor

Choose a reason for hiding this comment

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

nit: extra space

@@ -0,0 +1,26 @@
{
"family": "test-awslogs-secret-multiline",
Copy link
Contributor

Choose a reason for hiding this comment

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

curious, what does this multiline mean in this test exactly?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

To test if the secret is supported in a log driver generally, e.g. awslogs. In this case, secret will only be supported in optional awslogs log driver options, and only awslogs-multiline-pattern and awslogs-datetime-format options meet this requirement for both EC2 and Fargate launch type.
For awslogs-multiline-pattern:
"This option defines a multiline start pattern using a regular expression. A log message consists of a line that matches the pattern and any following lines that don’t match the pattern. Thus the matched line is the delimiter between log messages."
Check out this link to see more details:
https://docs.aws.amazon.com/AmazonECS/latest/developerguide/using_awslogs.html
Hope it helps :)

@tommyhahn tommyhahn force-pushed the logDriver_funcTests branch from efb8e11 to cf69d34 Compare March 22, 2019 22:12
@yumex93 yumex93 added bot/test and removed bot/test labels Mar 26, 2019
@tommyhahn tommyhahn force-pushed the logdriver_secret_support branch from eacb766 to 5346e97 Compare March 26, 2019 21:36
@tommyhahn tommyhahn force-pushed the logDriver_funcTests branch from cf69d34 to 6bf925a Compare March 26, 2019 21:38
@yumex93
Copy link
Contributor

yumex93 commented Mar 27, 2019

Can you take a look that why arm functional test failed?

@ubhattacharjya ubhattacharjya added this to the 1.27.0 milestone Mar 27, 2019
@tommyhahn tommyhahn changed the base branch from logdriver_secret_support to dev March 27, 2019 20:11
@tommyhahn tommyhahn changed the base branch from dev to logdriver_secret_support March 27, 2019 20:36
@tommyhahn tommyhahn changed the base branch from logdriver_secret_support to dev March 27, 2019 20:37
@tommyhahn tommyhahn merged commit deabb1b into aws:dev Mar 27, 2019
@tommyhahn tommyhahn deleted the logDriver_funcTests branch March 27, 2019 23:36
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.

4 participants