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

Implement fix for sles linux integ-test #278

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open

Implement fix for sles linux integ-test #278

wants to merge 2 commits into from

Conversation

JayPolanco
Copy link
Contributor

@JayPolanco JayPolanco commented Jun 24, 2023

Description of the issue

EC2 Linux SLES integ-tests were failing due to the test checking for the docker0 interface dimension for the net plugin on all EC2 instances.

SLES versions of Linux do not publish net metrics to docker0. They only publish to the eth0 interface dimension.

Description of changes

This change passes the OS using terraform, allowing us to check for the eth0 dimension when it's an SLES version of Linux

 {
  "test_dir": "./test/metric_value_benchmark",
  "os": "sles-15",
  "family": "linux",
  "testType": "ec2_linux",
  "arc": "amd64",
  "instanceType": "t3a.medium",
  "ami": "cloudwatch-agent-integration-test-sles-15*",
  "binaryName": "amazon-cloudwatch-agent.rpm",
  "username": "ec2-user",
  "installAgentCommand": "go run ./install/install_agent.go rpm",
  "caCertPath": "/etc/ssl/certs/ca-bundle.crt",
  "values_per_minute": 0,
  "k8s_version": "",
  "terraform_dir": "",
  "useSSM": false
 },

License

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

Tests

Successfully tested by running the workflow

@JayPolanco JayPolanco requested a review from a team as a code owner June 24, 2023 02:05
SaxyPandaBear
SaxyPandaBear previously approved these changes Jun 26, 2023
dims []types.Dimension
failed []dimension.Instruction
)
log.Println(fmt.Sprintf("OS VERSION IS %s", m.env.OS))
Copy link
Contributor

Choose a reason for hiding this comment

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

Why not just

Suggested change
log.Println(fmt.Sprintf("OS VERSION IS %s", m.env.OS))
log.Printf("OS VERSION IS %s\n", m.env.OS)

failed []dimension.Instruction
)
log.Println(fmt.Sprintf("OS VERSION IS %s", m.env.OS))
if strings.Contains(m.env.OS, "sles") {
Copy link
Contributor

Choose a reason for hiding this comment

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

nit - I'd prefer to use HasPrefix

Comment on lines +78 to +89
} else {
dims, failed = m.DimensionFactory.GetDimensions([]dimension.Instruction{
{
Key: "interface",
Value: dimension.ExpectedDimensionValue{aws.String("docker0")},
},
{
Key: "InstanceId",
Value: dimension.UnknownDimensionValue(),
},
})
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Frankly we could consolidate this since the only thing that differs is the name of the expected dimension.

var dimName string
if strings.HasPrefix(m.env.OS, "sles") {
  dimName = "eth0"
} else {
  dimName = "docker0"
}
dims, failed = m.DimensionFactory.GetDimensions([]dimension.Instruction{
	{
		Key:   "interface",
		Value: dimension.ExpectedDimensionValue{&dimName},
	},
	{
		Key:   "InstanceId",
		Value: dimension.UnknownDimensionValue(),
	},
})

@sky333999
Copy link
Contributor

I was curious how the other tests are working with the docker0 interface since that isnt something available typically by default. And just noticed we have a docker component baked into our AMIs - which is missing from the SLES ones. So we should update those and not need these OS level overrides in code.

@SaxyPandaBear SaxyPandaBear dismissed their stale review June 27, 2023 13:12

superseded by Kaushik's proposal

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