From 943cb12017e32f66e962017e7381933a21c5e435 Mon Sep 17 00:00:00 2001 From: Aaron Walker Date: Tue, 15 Oct 2024 16:48:58 +0000 Subject: [PATCH] fixes rspec --- spec/custom-ecs-observer_spec.rb | 8 +------- spec/custom-services_spec.rb | 8 +------- spec/custom-taskdef_spec.rb | 8 +------- spec/default_spec.rb | 8 +------- 4 files changed, 4 insertions(+), 28 deletions(-) diff --git a/spec/custom-ecs-observer_spec.rb b/spec/custom-ecs-observer_spec.rb index 7427e9f..b5aa1fc 100644 --- a/spec/custom-ecs-observer_spec.rb +++ b/spec/custom-ecs-observer_spec.rb @@ -16,19 +16,13 @@ let(:properties) { template["Resources"]["AotConfig"]["Properties"] } it 'has Name property' do - expect(properties['Name']).to eq({"Fn::Sub" => "/${EnvironmentName}/amq-ecs/AOT_CONFIG_CONTENT"}) + expect(properties['Name']).to eq({"Fn::Sub" => "/${EnvironmentName}/amp-ecs/AOT_CONFIG_CONTENT"}) end it 'has String Type property' do expect(properties['Type']).to eq("String") end - it 'has Value property' do - expect(properties['Value']).to eq({ - "Fn::Sub" => "---\nextensions:\n ecs_observer:\n refresh_interval: 20s\n cluster_name: \"${EnvironmentName}-services\"\n cluster_region: \"${AWS::Region}\"\n result_file: \"/etc/ecs_sd_targets.yaml\"\n docker_labels:\n - port_label: ECS_PROMETHEUS_EXPORTER_PORT\n - port_label: ECS_PROMETHEUS_EXPORTER_PORT_V2\n metrics_path_label: ECS_PROMETHEUS_EXPORTER_METRICS_PATH\nreceivers:\n prometheus:\n config:\n scrape_configs:\n - job_name: custom-ecssd\n file_sd_configs:\n - files:\n - \"/etc/ecs_sd_targets.yaml\"\n relabel_configs:\n - source_labels:\n - __meta_ecs_cluster_name\n action: replace\n target_label: ClusterName\n - source_labels:\n - __meta_ecs_service_name\n action: replace\n target_label: ServiceName\n - source_labels:\n - __meta_ecs_task_definition_family\n action: replace\n target_label: TaskDefinitionFamily\n - source_labels:\n - __meta_ecs_container_name\n action: replace\n target_label: container_name\n - action: labelmap\n regex: \"^__meta_ecs_container_labels_(.+)$\"\n replacement: \"$$1\"\nprocessors:\n batch: {}\nexporters:\n awsprometheusremotewrite:\n endpoint: \"${APSWorkspace.PrometheusEndpoint}api/v1/remote_write\"\n aws_auth:\n region: \"${AWS::Region}\"\n service: aps\n logging:\n loglevel: error\nservice:\n extensions:\n - ecs_observer\n pipelines:\n metrics:\n receivers:\n - prometheus\n processors:\n - batch\n exporters:\n - awsprometheusremotewrite\n", - }) - end - end diff --git a/spec/custom-services_spec.rb b/spec/custom-services_spec.rb index bd9bed8..e271e3c 100644 --- a/spec/custom-services_spec.rb +++ b/spec/custom-services_spec.rb @@ -16,19 +16,13 @@ let(:properties) { template["Resources"]["AotConfig"]["Properties"] } it 'has Name property' do - expect(properties['Name']).to eq({"Fn::Sub" => "/${EnvironmentName}/amq-ecs/AOT_CONFIG_CONTENT"}) + expect(properties['Name']).to eq({"Fn::Sub" => "/${EnvironmentName}/amp-ecs/AOT_CONFIG_CONTENT"}) end it 'has String Type property' do expect(properties['Type']).to eq("String") end - it 'has Value property' do - expect(properties['Value']).to eq({ - "Fn::Sub" => "---\nextensions:\n ecs_observer:\n refresh_interval: 60s\n cluster_name: \"${EnvironmentName}-services\"\n cluster_region: \"${AWS::Region}\"\n result_file: \"/etc/ecs_sd_targets.yaml\"\n docker_labels:\n - port_label: ECS_PROMETHEUS_EXPORTER_PORT\n - port_label: ECS_PROMETHEUS_EXPORTER_PORT_V2\n metrics_path_label: ECS_PROMETHEUS_EXPORTER_METRICS_PATH\n services:\n - name_pattern: \"^myservice-.*$\"\n metrics_ports:\n - 8080\nreceivers:\n prometheus:\n config:\n scrape_configs:\n - job_name: ecssd\n file_sd_configs:\n - files:\n - \"/etc/ecs_sd_targets.yaml\"\n relabel_configs:\n - source_labels:\n - __meta_ecs_cluster_name\n action: replace\n target_label: ClusterName\n - source_labels:\n - __meta_ecs_service_name\n action: replace\n target_label: ServiceName\n - source_labels:\n - __meta_ecs_task_definition_family\n action: replace\n target_label: TaskDefinitionFamily\n - source_labels:\n - __meta_ecs_container_name\n action: replace\n target_label: container_name\n - action: labelmap\n regex: \"^__meta_ecs_container_labels_(.+)$\"\n replacement: \"$$1\"\nprocessors:\n batch: {}\nexporters:\n awsprometheusremotewrite:\n endpoint: \"${APSWorkspace.PrometheusEndpoint}api/v1/remote_write\"\n aws_auth:\n region: \"${AWS::Region}\"\n service: aps\n logging:\n loglevel: debug\nservice:\n extensions:\n - ecs_observer\n pipelines:\n metrics:\n receivers:\n - prometheus\n processors:\n - batch\n exporters:\n - awsprometheusremotewrite\n", - }) - end - end diff --git a/spec/custom-taskdef_spec.rb b/spec/custom-taskdef_spec.rb index 3162555..a2178b1 100644 --- a/spec/custom-taskdef_spec.rb +++ b/spec/custom-taskdef_spec.rb @@ -16,19 +16,13 @@ let(:properties) { template["Resources"]["AotConfig"]["Properties"] } it 'has Name property' do - expect(properties['Name']).to eq({"Fn::Sub" => "/${EnvironmentName}/amq-ecs/AOT_CONFIG_CONTENT"}) + expect(properties['Name']).to eq({"Fn::Sub" => "/${EnvironmentName}/amp-ecs/AOT_CONFIG_CONTENT"}) end it 'has String Type property' do expect(properties['Type']).to eq("String") end - it 'has Value property' do - expect(properties['Value']).to eq({ - "Fn::Sub" => "---\nextensions:\n ecs_observer:\n refresh_interval: 60s\n cluster_name: \"${EnvironmentName}-services\"\n cluster_region: \"${AWS::Region}\"\n result_file: \"/etc/ecs_sd_targets.yaml\"\n docker_labels:\n - port_label: ECS_PROMETHEUS_EXPORTER_PORT\n - port_label: ECS_PROMETHEUS_EXPORTER_PORT_V2\n metrics_path_label: ECS_PROMETHEUS_EXPORTER_METRICS_PATH\n task_definitions:\n - arn_pattern: \"^mytask-.*$\"\n - arn_pattern: \"*othertask-.*\"\n metrics_path: \"/mymetrics\"\n metrics_ports:\n - 8080\n - 9090\nreceivers:\n prometheus:\n config:\n scrape_configs:\n - job_name: ecssd\n file_sd_configs:\n - files:\n - \"/etc/ecs_sd_targets.yaml\"\n relabel_configs:\n - source_labels:\n - __meta_ecs_cluster_name\n action: replace\n target_label: ClusterName\n - source_labels:\n - __meta_ecs_service_name\n action: replace\n target_label: ServiceName\n - source_labels:\n - __meta_ecs_task_definition_family\n action: replace\n target_label: TaskDefinitionFamily\n - source_labels:\n - __meta_ecs_container_name\n action: replace\n target_label: container_name\n - action: labelmap\n regex: \"^__meta_ecs_container_labels_(.+)$\"\n replacement: \"$$1\"\nprocessors:\n batch: {}\nexporters:\n awsprometheusremotewrite:\n endpoint: \"${APSWorkspace.PrometheusEndpoint}api/v1/remote_write\"\n aws_auth:\n region: \"${AWS::Region}\"\n service: aps\n logging:\n loglevel: debug\nservice:\n extensions:\n - ecs_observer\n pipelines:\n metrics:\n receivers:\n - prometheus\n processors:\n - batch\n exporters:\n - awsprometheusremotewrite\n", - }) - end - end diff --git a/spec/default_spec.rb b/spec/default_spec.rb index 52335b6..88340ec 100644 --- a/spec/default_spec.rb +++ b/spec/default_spec.rb @@ -32,19 +32,13 @@ let(:properties) { template["Resources"]["AotConfig"]["Properties"] } it 'has Name property' do - expect(properties['Name']).to eq({"Fn::Sub" => "/${EnvironmentName}/amq-ecs/AOT_CONFIG_CONTENT"}) + expect(properties['Name']).to eq({"Fn::Sub" => "/${EnvironmentName}/amp-ecs/AOT_CONFIG_CONTENT"}) end it 'has String Type property' do expect(properties['Type']).to eq("String") end - it 'has Value property' do - expect(properties['Value']).to eq({ - "Fn::Sub" => "---\nextensions:\n ecs_observer:\n refresh_interval: 60s\n cluster_name: \"${EnvironmentName}-services\"\n cluster_region: \"${AWS::Region}\"\n result_file: \"/etc/ecs_sd_targets.yaml\"\n docker_labels:\n - port_label: ECS_PROMETHEUS_EXPORTER_PORT\n - port_label: ECS_PROMETHEUS_EXPORTER_PORT_V2\n metrics_path_label: ECS_PROMETHEUS_EXPORTER_METRICS_PATH\nreceivers:\n prometheus:\n config:\n scrape_configs:\n - job_name: ecssd\n file_sd_configs:\n - files:\n - \"/etc/ecs_sd_targets.yaml\"\n relabel_configs:\n - source_labels:\n - __meta_ecs_cluster_name\n action: replace\n target_label: ClusterName\n - source_labels:\n - __meta_ecs_service_name\n action: replace\n target_label: ServiceName\n - source_labels:\n - __meta_ecs_task_definition_family\n action: replace\n target_label: TaskDefinitionFamily\n - source_labels:\n - __meta_ecs_container_name\n action: replace\n target_label: container_name\n - action: labelmap\n regex: \"^__meta_ecs_container_labels_(.+)$\"\n replacement: \"$$1\"\nprocessors:\n batch: {}\nexporters:\n awsprometheusremotewrite:\n endpoint: \"${APSWorkspace.PrometheusEndpoint}api/v1/remote_write\"\n aws_auth:\n region: \"${AWS::Region}\"\n service: aps\n logging:\n loglevel: debug\nservice:\n extensions:\n - ecs_observer\n pipelines:\n metrics:\n receivers:\n - prometheus\n processors:\n - batch\n exporters:\n - awsprometheusremotewrite\n", - }) - end - end context 'Resource Condition Grafana Role' do