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 JMX E2E Tests in Terraform Framework #443

Open
wants to merge 91 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
91 commits
Select commit Hold shift + click to select a range
6f320b0
Preliminary testing.
musa-asad Nov 29, 2024
5727809
Support environment.
musa-asad Dec 1, 2024
912d98e
Fix file positioning.
musa-asad Dec 1, 2024
5d0362f
Fix file positioning.
musa-asad Dec 1, 2024
6740715
Fix values.
musa-asad Dec 1, 2024
c401c0e
Fix otel and prometheus config set-up.
musa-asad Dec 2, 2024
e8d4901
Remove jmx files.
musa-asad Dec 2, 2024
22186ed
Add jmx testing.
musa-asad Dec 2, 2024
7a02bc2
Merge branch 'main' into e2e
musa-asad Dec 4, 2024
b5b2fb9
Allow to choose e2e or regular tests.
musa-asad Dec 8, 2024
7672929
Merge remote-tracking branch 'origin/e2e' into e2e-jmx
musa-asad Dec 8, 2024
9a830a0
Add tomcat sessions check.
musa-asad Dec 8, 2024
5795103
Add TA.
musa-asad Dec 9, 2024
6a5f26e
Update jmx_test.go.
musa-asad Dec 9, 2024
c967e3d
Port foward and fix kafka.
musa-asad Dec 9, 2024
63b6ba8
Add CI.
musa-asad Dec 9, 2024
dfd94e0
Add TA.
musa-asad Dec 9, 2024
da21e5a
Merge branch 'main' into e2e
musa-asad Dec 9, 2024
82f7159
Merge branch 'e2e' into e2e-jmx
musa-asad Dec 9, 2024
ad76db4
Update to 2h.
musa-asad Dec 10, 2024
d918ffb
Remove port forwarding.
musa-asad Dec 11, 2024
987b005
Fix providers.
musa-asad Dec 11, 2024
9ea9eb2
Use loadbalancer.
musa-asad Dec 11, 2024
6f8d7d1
Fix json.
musa-asad Dec 12, 2024
ba53b14
Make 2 hours
musa-asad Dec 12, 2024
f5d2733
Fix providers.tf
musa-asad Dec 12, 2024
ee01d1b
Merge branch 'e2e' into e2e-jmx
musa-asad Dec 12, 2024
b6416ae
Add auth for IAM role.
musa-asad Dec 13, 2024
5714a7e
Verify cluster access.
musa-asad Dec 13, 2024
9a4bb6e
Remove force.
musa-asad Dec 13, 2024
8628c7d
Add assume role.
musa-asad Dec 13, 2024
20fa9be
Update JMX tests.
musa-asad Dec 13, 2024
cfc6fe1
Consumer only metrics.
musa-asad Dec 13, 2024
ff5cb0a
Fix formatting.
musa-asad Dec 13, 2024
82f9d34
Remove unnecessary resources.
musa-asad Dec 13, 2024
e6b5faa
Fix formatting.
musa-asad Dec 13, 2024
17657f0
Remove unnecessary resources.
musa-asad Dec 13, 2024
1969fe0
5 minutes.
musa-asad Dec 13, 2024
f18fd26
Merge branch 'e2e' into e2e-jmx
musa-asad Dec 13, 2024
e0fbd7e
Remove redundant logic.
musa-asad Dec 13, 2024
537cb6f
Revert "Remove redundant logic."
musa-asad Dec 13, 2024
43b7dae
Remove redundant logic.
musa-asad Dec 13, 2024
d2b7860
Remove redundant logic.
musa-asad Dec 13, 2024
371e8ca
Merge branch 'e2e' into e2e-jmx
musa-asad Dec 13, 2024
18b1257
Use older version of Kafka and update annotations/config to include K…
musa-asad Dec 15, 2024
67f3247
Missing.
musa-asad Dec 15, 2024
497c79b
Allow for float metrics.
musa-asad Dec 15, 2024
65272af
Set to 1 node.
musa-asad Dec 16, 2024
9f9e9db
Use 0.01.
musa-asad Dec 16, 2024
4ea25c2
Consumer only metrics.
musa-asad Dec 16, 2024
dbea081
Update nodes.
musa-asad Dec 16, 2024
08c2780
Merge branch 'e2e' into e2e-jmx
musa-asad Dec 16, 2024
a0c088e
Merge branch 'main' into e2e-jmx
musa-asad Dec 16, 2024
37dcf0b
Allow node configuration.
musa-asad Dec 16, 2024
cf4a54c
Fix spacing.
musa-asad Dec 16, 2024
58101e3
Add license.
musa-asad Dec 16, 2024
0db3337
Check for max metric value.
musa-asad Dec 17, 2024
803bad7
Simplify
musa-asad Dec 17, 2024
3611226
Fix imports.
musa-asad Dec 17, 2024
123f8e5
Prevent test from running when it doesn't need to.
musa-asad Dec 17, 2024
9591142
Update logic for max metric value.
musa-asad Dec 17, 2024
6fcde7e
Improve logic to check nodes being ran.
musa-asad Dec 17, 2024
0533bfa
Delete loadbalancer after complete
musa-asad Dec 17, 2024
c995fc7
constant
musa-asad Dec 17, 2024
5efca7c
constant
musa-asad Dec 17, 2024
a10dc57
Merge branch 'main' into e2e-jmx
musa-asad Dec 18, 2024
b9ae22b
Merge branch 'main' into e2e-jmx
musa-asad Dec 18, 2024
74c44df
address initial comments
musa-asad Dec 18, 2024
5d0af54
addressed comments
musa-asad Dec 19, 2024
917a606
change generator
musa-asad Dec 19, 2024
975168c
clean
musa-asad Dec 19, 2024
28e5c55
update sample
musa-asad Dec 20, 2024
8bf4517
fix kafka
musa-asad Dec 20, 2024
8e94f74
minor adjustments
musa-asad Dec 20, 2024
2fbb559
check annotations
musa-asad Dec 20, 2024
4360691
clean up
musa-asad Dec 20, 2024
7ab4f90
30m
musa-asad Dec 20, 2024
91aa2ad
clean function
musa-asad Dec 20, 2024
953272d
spacing
musa-asad Dec 20, 2024
545a256
move variable
musa-asad Dec 20, 2024
67c6371
move variable
musa-asad Dec 20, 2024
78287c6
remove bad exit
musa-asad Dec 20, 2024
bf1c276
remove quotes
musa-asad Dec 20, 2024
9799dc9
adjust waits
musa-asad Dec 20, 2024
13a6985
fix for ci dimensions
musa-asad Dec 20, 2024
e125678
fix for ci dimensions
musa-asad Dec 20, 2024
1e29443
fix for ci dimensions
musa-asad Dec 20, 2024
a8f40e2
typo
musa-asad Dec 20, 2024
2fb3b53
remove var
musa-asad Dec 20, 2024
bef2af6
switch to nodeport
musa-asad Dec 22, 2024
8cb81ce
5 min
musa-asad Dec 22, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,5 @@ terraform.*
**/.terraform/*
/test/**/final_*.yml
coverage.txt
generator/resources/*complete*.json
generator/resources/*complete*.json
terraform/eks/e2e/helm-charts
4 changes: 4 additions & 0 deletions environment/metadata.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ type MetaData struct {
AmpWorkspaceId string
Region string
K8sVersion string
Destroy bool
HelmChartsBranch string
CloudwatchAgentRepository string
CloudwatchAgentTag string
Expand Down Expand Up @@ -87,6 +88,7 @@ type MetaDataStrings struct {
AmpWorkspaceId string
Region string
K8sVersion string
Destroy string
HelmChartsBranch string
CloudwatchAgentRepository string
CloudwatchAgentTag string
Expand Down Expand Up @@ -136,6 +138,7 @@ func registerEKSData(d *MetaDataStrings) {
func registerEKSE2ETestData(dataString *MetaDataStrings) {
flag.StringVar(&(dataString.Region), "region", "", "AWS region")
flag.StringVar(&(dataString.K8sVersion), "k8s_version", "", "Kubernetes version")
flag.StringVar(&(dataString.Destroy), "destroy", "false", "Whether to run in destroy mode (true/false)")
flag.StringVar(&(dataString.HelmChartsBranch), "helm_charts_branch", "", "Helm charts branch")
flag.StringVar(&(dataString.CloudwatchAgentRepository), "cloudwatch_agent_repository", "", "CloudWatch Agent repository")
flag.StringVar(&(dataString.CloudwatchAgentTag), "cloudwatch_agent_tag", "", "CloudWatch Agent tag")
Expand Down Expand Up @@ -318,6 +321,7 @@ func GetEnvironmentMetaData() *MetaData {
metaDataStorage.AmpWorkspaceId = registeredMetaDataStrings.AmpWorkspaceId
metaDataStorage.Region = registeredMetaDataStrings.Region
metaDataStorage.K8sVersion = registeredMetaDataStrings.K8sVersion
metaDataStorage.Destroy = registeredMetaDataStrings.Destroy == "true"
metaDataStorage.HelmChartsBranch = registeredMetaDataStrings.HelmChartsBranch
metaDataStorage.CloudwatchAgentRepository = registeredMetaDataStrings.CloudwatchAgentRepository
metaDataStorage.CloudwatchAgentTag = registeredMetaDataStrings.CloudwatchAgentTag
Expand Down
5 changes: 5 additions & 0 deletions generator/resources/eks_e2e_jmx_test_matrix.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
[
{
"nodes": 1
}
]
5 changes: 0 additions & 5 deletions generator/resources/eks_e2e_test_matrix.json

This file was deleted.

3 changes: 2 additions & 1 deletion generator/test_case_generator.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ type matrixRow struct {
CaCertPath string `json:"caCertPath"`
ValuesPerMinute int `json:"values_per_minute"` // Number of metrics to be sent or number of log lines to write
K8sVersion string `json:"k8sVersion"`
Nodes int `json:"nodes"`
TerraformDir string `json:"terraform_dir"`
UseSSM bool `json:"useSSM"`
ExcludedTests string `json:"excludedTests"`
Expand Down Expand Up @@ -247,7 +248,7 @@ var testTypeToTestConfig = map[string][]testConfig{
}

var testTypeToTestConfigE2E = map[string][]testConfig{
"eks_e2e": {
"eks_e2e_jmx": {
{testDir: "../../../test/e2e/jmx"},
},
}
Expand Down
32 changes: 30 additions & 2 deletions terraform/eks/e2e/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,10 @@ resource "aws_eks_node_group" "this" {
min_size = var.nodes
}

ami_type = "AL2_x86_64"
ami_type = var.ami_type
capacity_type = "ON_DEMAND"
disk_size = 20
instance_types = ["t3a.medium"]
instance_types = [var.instance_type]

depends_on = [
aws_iam_role_policy_attachment.node_CloudWatchAgentServerPolicy,
Expand All @@ -52,6 +52,15 @@ resource "aws_eks_node_group" "this" {
]
}

resource "aws_security_group_rule" "nodeport_inbound" {
type = "ingress"
from_port = 30080
to_port = 30080
protocol = "tcp"
cidr_blocks = ["0.0.0.0/0"]
security_group_id = aws_eks_cluster.this.vpc_config[0].cluster_security_group_id
}

resource "aws_iam_role" "node_role" {
name = "${local.cluster_name}-Worker-Role-${module.common.testing_id}"

Expand Down Expand Up @@ -109,6 +118,12 @@ resource "null_resource" "helm_charts" {
resource "null_resource" "validator" {
depends_on = [aws_eks_cluster.this, aws_eks_node_group.this, null_resource.helm_charts]

triggers = {
cluster_name = aws_eks_cluster.this.name
region = var.region
test_dir = var.test_dir
}

provisioner "local-exec" {
command = <<-EOT
echo "Validating K8s resources and metrics"
Expand All @@ -134,4 +149,17 @@ resource "null_resource" "validator" {
-sample_app="${var.test_dir}/${var.sample_app}"
EOT
}

provisioner "local-exec" {
when = destroy
command = <<-EOT
echo "Running cleanup for K8s resources"
go test -timeout 30m -v ${self.triggers.test_dir} \
-destroy=true \
-region=${self.triggers.region} \
-eksClusterName=${self.triggers.cluster_name} \
-computeType=EKS \
-eksDeploymentStrategy=DAEMON
EOT
}
}
10 changes: 10 additions & 0 deletions terraform/eks/e2e/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,16 @@ variable "nodes" {
default = 1
}

variable "ami_type" {
type = string
default = "AL2_x86_64"
}

variable "instance_type" {
type = string
default = "t3a.medium"
}

variable "helm_charts_branch" {
type = string
default = "main"
Expand Down
Loading
Loading