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

Fix for fluent integration tests for Windows #438

Merged
merged 6 commits into from
Dec 3, 2024
Merged

Conversation

musa-asad
Copy link
Contributor

@musa-asad musa-asad commented Dec 3, 2024

Description of the issue

The fluent tests for Windows reference out-of-scope resources in the provider.tf and don't wait for the amazon-cloudwatch namespace before creating the kubernetes_config_map.cwagentconfig and kubernetes_service_account.fluentbit_service resources.

Description of changes

  • Use corresponding in-scope resources in the provider.tf.
  • Make the kubernetes_config_map.cwagentconfig and kubernetes_service_account.fluentbit_service resources depend on kubernetes_namespace.namespace.
  • Prevented race condition to allow fluent-bit to fully push logs to CW.

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

Ran locally with terraform apply:

module.windows.null_resource.validator (local-exec):     fluent_test.go:110: finishing EKS fluent log validation...
module.windows.null_resource.validator (local-exec): --- PASS: TestFluentLogs (2.18s)
module.windows.null_resource.validator (local-exec): PASS
module.windows.null_resource.validator (local-exec): ok         github.com/aws/amazon-cloudwatch-agent-test/test/fluent 2.481s
module.windows.null_resource.validator: Creation complete after 5s

Apply complete! Resources: 32 added, 0 changed, 0 destroyed.

Made following changes for it to work locally since the linux binary doesn't work on Mac:

provisioner "local-exec" {
    command = <<-EOT
      kubectl apply -f ./../../../default_resources/fluenbit-windows-configmap.yaml
      kubectl apply -f ./../../../default_resources/fluenbit-windows-daemonset.yaml
      kubectl rollout status daemonset fluent-bit-windows -n amazon-cloudwatch --timeout 600s
      sed -e 's+WINDOWS_SERVER_VERSION+${var.windows_os_version}+' -e 's+REPLICAS+1+' ./../../../default_resources/test-sample-windows.yaml | kubectl apply -f -
      kubectl rollout status deployment windows-test-deployment --timeout 600s
      sleep 120
    EOT
  }
}

Ran workflow: https://github.com/aws/amazon-cloudwatch-agent/actions/runs/12147698823

@musa-asad musa-asad requested review from movence and lisguo December 3, 2024 05:10
@musa-asad musa-asad self-assigned this Dec 3, 2024
@musa-asad musa-asad marked this pull request as ready for review December 3, 2024 21:01
@musa-asad musa-asad requested a review from a team as a code owner December 3, 2024 21:01
@musa-asad musa-asad merged commit b38bdc0 into main Dec 3, 2024
4 checks passed
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.

3 participants