From 110c06a6cc94103fb0c17c8b0c3cdbac81e997b4 Mon Sep 17 00:00:00 2001 From: Himanshu Rai Date: Thu, 29 Aug 2024 11:41:08 +0530 Subject: [PATCH 01/29] failing all testcases --- integration-tests/test-suite/syslog.test.js | 8 ++++---- integration-tests/test-suite/systemd.test.js | 4 ++-- integration-tests/test-suite/tail.test.js | 4 ++-- integration-tests/test-suite/tcp.test.js | 4 ++-- .../{amazonlinux_2.yml => amazonlinux_2.yml.disabled} | 0 ...amazonlinux_2023.yml => amazonlinux_2023.yml.disabled} | 0 versions/{centos_7.yml => centos_7.yml.disabled} | 0 versions/{centos_8.yml => centos_8.yml.disabled} | 0 versions/{centos_9.yml => centos_9.yml.disabled} | 0 ...debian_10_buster.yml => debian_10_buster.yml.disabled} | 0 ...an_11_bullseye.yml => debian_11_bullseye.yml.disabled} | 0 ...an_12_bookworm.yml => debian_12_bookworm.yml.disabled} | 0 versions/{sles_12.1.yml => sles_12.1.yml.disabled} | 0 versions/{sles_12.2.yml => sles_12.2.yml.disabled} | 0 versions/{sles_12.3.yml => sles_12.3.yml.disabled} | 0 versions/{sles_12.4.yml => sles_12.4.yml.disabled} | 0 versions/{sles_12.5.yml => sles_12.5.yml.disabled} | 0 versions/{sles_15.1.yml => sles_15.1.yml.disabled} | 0 versions/{sles_15.2.yml => sles_15.2.yml.disabled} | 0 versions/{sles_15.3.yml => sles_15.3.yml.disabled} | 0 versions/{sles_15.4.yml => sles_15.4.yml.disabled} | 0 versions/{sles_15.5.yml => sles_15.5.yml.disabled} | 0 ...ubuntu_18_bionic.yml => ubuntu_18_bionic.yml.disabled} | 0 .../{ubuntu_20_focal.yml => ubuntu_20_focal.yml.disabled} | 0 .../{ubuntu_24_noble.yml => ubuntu_24_noble.yml.disabled} | 0 ...s-server-2019.yml => windows-server-2019.yml.disabled} | 0 ...s-server-2022.yml => windows-server-2022.yml.disabled} | 0 27 files changed, 10 insertions(+), 10 deletions(-) rename versions/{amazonlinux_2.yml => amazonlinux_2.yml.disabled} (100%) rename versions/{amazonlinux_2023.yml => amazonlinux_2023.yml.disabled} (100%) rename versions/{centos_7.yml => centos_7.yml.disabled} (100%) rename versions/{centos_8.yml => centos_8.yml.disabled} (100%) rename versions/{centos_9.yml => centos_9.yml.disabled} (100%) rename versions/{debian_10_buster.yml => debian_10_buster.yml.disabled} (100%) rename versions/{debian_11_bullseye.yml => debian_11_bullseye.yml.disabled} (100%) rename versions/{debian_12_bookworm.yml => debian_12_bookworm.yml.disabled} (100%) rename versions/{sles_12.1.yml => sles_12.1.yml.disabled} (100%) rename versions/{sles_12.2.yml => sles_12.2.yml.disabled} (100%) rename versions/{sles_12.3.yml => sles_12.3.yml.disabled} (100%) rename versions/{sles_12.4.yml => sles_12.4.yml.disabled} (100%) rename versions/{sles_12.5.yml => sles_12.5.yml.disabled} (100%) rename versions/{sles_15.1.yml => sles_15.1.yml.disabled} (100%) rename versions/{sles_15.2.yml => sles_15.2.yml.disabled} (100%) rename versions/{sles_15.3.yml => sles_15.3.yml.disabled} (100%) rename versions/{sles_15.4.yml => sles_15.4.yml.disabled} (100%) rename versions/{sles_15.5.yml => sles_15.5.yml.disabled} (100%) rename versions/{ubuntu_18_bionic.yml => ubuntu_18_bionic.yml.disabled} (100%) rename versions/{ubuntu_20_focal.yml => ubuntu_20_focal.yml.disabled} (100%) rename versions/{ubuntu_24_noble.yml => ubuntu_24_noble.yml.disabled} (100%) rename versions/{windows-server-2019.yml => windows-server-2019.yml.disabled} (100%) rename versions/{windows-server-2022.yml => windows-server-2022.yml.disabled} (100%) diff --git a/integration-tests/test-suite/syslog.test.js b/integration-tests/test-suite/syslog.test.js index 8c81e8dc..009767c0 100644 --- a/integration-tests/test-suite/syslog.test.js +++ b/integration-tests/test-suite/syslog.test.js @@ -67,7 +67,7 @@ describe('SYSLOG tests', () => { testOnlyIfSet('MONITORED_SYSLOG_RFC_5424_TCP_PORT')('detects writing to a TCP socket with a syslog RFC 5424 message', async () => { // Create a string with a unique value in it so that we can find it later - const uuid = uuidv4(); + const uuid = "4567"; const message = `fluent-bit-tests: syslog (TCP socket - RFC 5424) ${uuid}`; const syslog = rfc5424(message); @@ -76,12 +76,12 @@ describe('SYSLOG tests', () => { writeToTcpSocket(port, syslog); // Wait for that log line to show up in NRDB - await waitForLogMessageContaining(nrdb, uuid); + await waitForLogMessageContaining(nrdb, "abcd"); }); testOnlyIfSet('MONITORED_SYSLOG_RFC_5424_UDP_PORT')('detects writing to a UDP socket with a syslog RFC 5424 message', async () => { // Create a string with a unique value in it so that we can find it later - const uuid = uuidv4(); + const uuid = "1234"; const message = `fluent-bit-tests: syslog (UDP socket - RFC 5424) ${uuid}`; const syslog = rfc5424(message); @@ -90,7 +90,7 @@ describe('SYSLOG tests', () => { writeToUdpSocket(port, syslog); // Wait for that log line to show up in NRDB - await waitForLogMessageContaining(nrdb, uuid); + await waitForLogMessageContaining(nrdb, "abcd"); }); }); \ No newline at end of file diff --git a/integration-tests/test-suite/systemd.test.js b/integration-tests/test-suite/systemd.test.js index c881ebca..51978a15 100644 --- a/integration-tests/test-suite/systemd.test.js +++ b/integration-tests/test-suite/systemd.test.js @@ -54,14 +54,14 @@ describe('SYSTEMD unit input', () => { expect(monitoredSystemdUnit).toMatch(/^ssh|sshd$/); // This is 'ssh' in some distros, 'sshd' in others // Create a unique string so that we can find the log message later - const uuid = uuidv4(); + const uuid = "1234"; // Cause a message with the UUID to be written to journald // Should log something containing "input_userauth_request: invalid user ${uuid} [preauth]" causeJournaldMessageToBeWrittenForSsh(uuid); // Wait for that log line to show up in NRDB - await waitForLogMessageContaining(nrdb, uuid); + await waitForLogMessageContaining(nrdb, "abcdef"); }); }); \ No newline at end of file diff --git a/integration-tests/test-suite/tail.test.js b/integration-tests/test-suite/tail.test.js index 80feb0cf..3fa732a9 100644 --- a/integration-tests/test-suite/tail.test.js +++ b/integration-tests/test-suite/tail.test.js @@ -40,7 +40,7 @@ describe('TAIL input', () => { testOnlyIfSet('MONITORED_FILE')('detects appending to a file', async () => { // Create a string with a unique value in it so that we can find it later - const uuid = uuidv4(); + const uuid = "12345"; const line = `fluent-bit-tests: tail ${uuid}`; // Append that string to our test log file @@ -48,7 +48,7 @@ describe('TAIL input', () => { appendTo(file, line); // Wait for that log line to show up in NRDB - await waitForLogMessageContaining(nrdb, uuid); + await waitForLogMessageContaining(nrdb, "abcdef"); }); }); \ No newline at end of file diff --git a/integration-tests/test-suite/tcp.test.js b/integration-tests/test-suite/tcp.test.js index 573648e3..e917d201 100644 --- a/integration-tests/test-suite/tcp.test.js +++ b/integration-tests/test-suite/tcp.test.js @@ -62,7 +62,7 @@ describe('TCP input', () => { testOnlyIfSet('MONITORED_TCP_PORT')('detects writing to TCP port', async () => { // Create a string with a unique value in it so that we can find it later - const uuid = uuidv4(); + const uuid = "abcdef"; const line = `fluent-bit-tests: tcp ${uuid}`; // Write that string to the TCP socket @@ -70,7 +70,7 @@ describe('TCP input', () => { writeToTcpSocket(port, line); // Wait for that log line to show up in NRDB - await waitForLogMessageContaining(nrdb, uuid); + await waitForLogMessageContaining(nrdb, "12345"); }); }); \ No newline at end of file diff --git a/versions/amazonlinux_2.yml b/versions/amazonlinux_2.yml.disabled similarity index 100% rename from versions/amazonlinux_2.yml rename to versions/amazonlinux_2.yml.disabled diff --git a/versions/amazonlinux_2023.yml b/versions/amazonlinux_2023.yml.disabled similarity index 100% rename from versions/amazonlinux_2023.yml rename to versions/amazonlinux_2023.yml.disabled diff --git a/versions/centos_7.yml b/versions/centos_7.yml.disabled similarity index 100% rename from versions/centos_7.yml rename to versions/centos_7.yml.disabled diff --git a/versions/centos_8.yml b/versions/centos_8.yml.disabled similarity index 100% rename from versions/centos_8.yml rename to versions/centos_8.yml.disabled diff --git a/versions/centos_9.yml b/versions/centos_9.yml.disabled similarity index 100% rename from versions/centos_9.yml rename to versions/centos_9.yml.disabled diff --git a/versions/debian_10_buster.yml b/versions/debian_10_buster.yml.disabled similarity index 100% rename from versions/debian_10_buster.yml rename to versions/debian_10_buster.yml.disabled diff --git a/versions/debian_11_bullseye.yml b/versions/debian_11_bullseye.yml.disabled similarity index 100% rename from versions/debian_11_bullseye.yml rename to versions/debian_11_bullseye.yml.disabled diff --git a/versions/debian_12_bookworm.yml b/versions/debian_12_bookworm.yml.disabled similarity index 100% rename from versions/debian_12_bookworm.yml rename to versions/debian_12_bookworm.yml.disabled diff --git a/versions/sles_12.1.yml b/versions/sles_12.1.yml.disabled similarity index 100% rename from versions/sles_12.1.yml rename to versions/sles_12.1.yml.disabled diff --git a/versions/sles_12.2.yml b/versions/sles_12.2.yml.disabled similarity index 100% rename from versions/sles_12.2.yml rename to versions/sles_12.2.yml.disabled diff --git a/versions/sles_12.3.yml b/versions/sles_12.3.yml.disabled similarity index 100% rename from versions/sles_12.3.yml rename to versions/sles_12.3.yml.disabled diff --git a/versions/sles_12.4.yml b/versions/sles_12.4.yml.disabled similarity index 100% rename from versions/sles_12.4.yml rename to versions/sles_12.4.yml.disabled diff --git a/versions/sles_12.5.yml b/versions/sles_12.5.yml.disabled similarity index 100% rename from versions/sles_12.5.yml rename to versions/sles_12.5.yml.disabled diff --git a/versions/sles_15.1.yml b/versions/sles_15.1.yml.disabled similarity index 100% rename from versions/sles_15.1.yml rename to versions/sles_15.1.yml.disabled diff --git a/versions/sles_15.2.yml b/versions/sles_15.2.yml.disabled similarity index 100% rename from versions/sles_15.2.yml rename to versions/sles_15.2.yml.disabled diff --git a/versions/sles_15.3.yml b/versions/sles_15.3.yml.disabled similarity index 100% rename from versions/sles_15.3.yml rename to versions/sles_15.3.yml.disabled diff --git a/versions/sles_15.4.yml b/versions/sles_15.4.yml.disabled similarity index 100% rename from versions/sles_15.4.yml rename to versions/sles_15.4.yml.disabled diff --git a/versions/sles_15.5.yml b/versions/sles_15.5.yml.disabled similarity index 100% rename from versions/sles_15.5.yml rename to versions/sles_15.5.yml.disabled diff --git a/versions/ubuntu_18_bionic.yml b/versions/ubuntu_18_bionic.yml.disabled similarity index 100% rename from versions/ubuntu_18_bionic.yml rename to versions/ubuntu_18_bionic.yml.disabled diff --git a/versions/ubuntu_20_focal.yml b/versions/ubuntu_20_focal.yml.disabled similarity index 100% rename from versions/ubuntu_20_focal.yml rename to versions/ubuntu_20_focal.yml.disabled diff --git a/versions/ubuntu_24_noble.yml b/versions/ubuntu_24_noble.yml.disabled similarity index 100% rename from versions/ubuntu_24_noble.yml rename to versions/ubuntu_24_noble.yml.disabled diff --git a/versions/windows-server-2019.yml b/versions/windows-server-2019.yml.disabled similarity index 100% rename from versions/windows-server-2019.yml rename to versions/windows-server-2019.yml.disabled diff --git a/versions/windows-server-2022.yml b/versions/windows-server-2022.yml.disabled similarity index 100% rename from versions/windows-server-2022.yml rename to versions/windows-server-2022.yml.disabled From d3715dcdf75cd34fdc3e89f77fe4b981a19d8cad Mon Sep 17 00:00:00 2001 From: Himanshu Rai Date: Thu, 29 Aug 2024 14:14:00 +0530 Subject: [PATCH 02/29] failing all testcases 2 --- ansible/provision-and-execute-tests/playbook-run-tests.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ansible/provision-and-execute-tests/playbook-run-tests.yml b/ansible/provision-and-execute-tests/playbook-run-tests.yml index 2526ecab..140a672a 100644 --- a/ansible/provision-and-execute-tests/playbook-run-tests.yml +++ b/ansible/provision-and-execute-tests/playbook-run-tests.yml @@ -37,7 +37,7 @@ - name: Make sure we run the expected fluent-bit version ansible.builtin.assert: that: - - "{{ fb_version == installed_fb_version.stdout }}" + - "{{ fb_version != installed_fb_version.stdout }}" fail_msg: "Expected fluent-bit version {{ fb_version }}, but got {{ installed_fb_version.stdout }}" - name: Configure log forwarding From 2f7e979191d938824f87ef4233e9749763382af1 Mon Sep 17 00:00:00 2001 From: Himanshu Rai Date: Mon, 2 Sep 2024 12:31:31 +0530 Subject: [PATCH 03/29] failing all testcases 3 --- ansible/provision-and-execute-tests/playbook-run-tests.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ansible/provision-and-execute-tests/playbook-run-tests.yml b/ansible/provision-and-execute-tests/playbook-run-tests.yml index 140a672a..2526ecab 100644 --- a/ansible/provision-and-execute-tests/playbook-run-tests.yml +++ b/ansible/provision-and-execute-tests/playbook-run-tests.yml @@ -37,7 +37,7 @@ - name: Make sure we run the expected fluent-bit version ansible.builtin.assert: that: - - "{{ fb_version != installed_fb_version.stdout }}" + - "{{ fb_version == installed_fb_version.stdout }}" fail_msg: "Expected fluent-bit version {{ fb_version }}, but got {{ installed_fb_version.stdout }}" - name: Configure log forwarding From e356d9c967e0827f842b2264334e1a96cf53a469 Mon Sep 17 00:00:00 2001 From: Himanshu Rai Date: Mon, 2 Sep 2024 13:41:58 +0530 Subject: [PATCH 04/29] failing all testcases 4 --- versions/ubuntu_22_jammy.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/versions/ubuntu_22_jammy.yml b/versions/ubuntu_22_jammy.yml index db630bec..9f217a27 100644 --- a/versions/ubuntu_22_jammy.yml +++ b/versions/ubuntu_22_jammy.yml @@ -3,5 +3,5 @@ osVersion: jammy packages: - arch: amd64 ami: ami-03a03b8680a3d588e - - arch: arm64 - ami: ami-0058b7812506d8659 \ No newline at end of file + #- arch: arm64 + # ami: ami-0058b7812506d8659 \ No newline at end of file From a04b6dde135c3446f4af8c2a227cbe7b54f79a94 Mon Sep 17 00:00:00 2001 From: Himanshu Rai Date: Tue, 10 Sep 2024 17:18:05 +0530 Subject: [PATCH 05/29] testing with less wait times --- integration-tests/test-suite/lib/waitTimes.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/integration-tests/test-suite/lib/waitTimes.js b/integration-tests/test-suite/lib/waitTimes.js index 3a55b58a..6cce5e63 100644 --- a/integration-tests/test-suite/lib/waitTimes.js +++ b/integration-tests/test-suite/lib/waitTimes.js @@ -7,13 +7,13 @@ module.exports = { * * This is used both for the Logs API (see logsApi.js) and querying NerdGraph (see nerdGraph.js) */ - HTTP_RETRY_COUNT: 3, + HTTP_RETRY_COUNT: 1, /** * How long to wait between retrying a query -- either retrying because of an HTTP error (see retryingAxios.js), * or because of an error from NerdGraph (see nerdGraph.js) */ - WAIT_BETWEEN_QUERY_RETRIES: 5 * ONE_SECOND, + WAIT_BETWEEN_QUERY_RETRIES: 3 * ONE_SECOND, /** * How long it could take our pipeline to process data and get it into NRDB. From 451568041ec97df377f89769c777ecb447da36c2 Mon Sep 17 00:00:00 2001 From: Himanshu Rai Date: Wed, 11 Sep 2024 10:33:08 +0530 Subject: [PATCH 06/29] testing with reduced errors --- integration-tests/test-suite/syslog.test.js | 8 ++++---- integration-tests/test-suite/systemd.test.js | 4 ++-- integration-tests/test-suite/tail.test.js | 4 ++-- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/integration-tests/test-suite/syslog.test.js b/integration-tests/test-suite/syslog.test.js index 009767c0..8c81e8dc 100644 --- a/integration-tests/test-suite/syslog.test.js +++ b/integration-tests/test-suite/syslog.test.js @@ -67,7 +67,7 @@ describe('SYSLOG tests', () => { testOnlyIfSet('MONITORED_SYSLOG_RFC_5424_TCP_PORT')('detects writing to a TCP socket with a syslog RFC 5424 message', async () => { // Create a string with a unique value in it so that we can find it later - const uuid = "4567"; + const uuid = uuidv4(); const message = `fluent-bit-tests: syslog (TCP socket - RFC 5424) ${uuid}`; const syslog = rfc5424(message); @@ -76,12 +76,12 @@ describe('SYSLOG tests', () => { writeToTcpSocket(port, syslog); // Wait for that log line to show up in NRDB - await waitForLogMessageContaining(nrdb, "abcd"); + await waitForLogMessageContaining(nrdb, uuid); }); testOnlyIfSet('MONITORED_SYSLOG_RFC_5424_UDP_PORT')('detects writing to a UDP socket with a syslog RFC 5424 message', async () => { // Create a string with a unique value in it so that we can find it later - const uuid = "1234"; + const uuid = uuidv4(); const message = `fluent-bit-tests: syslog (UDP socket - RFC 5424) ${uuid}`; const syslog = rfc5424(message); @@ -90,7 +90,7 @@ describe('SYSLOG tests', () => { writeToUdpSocket(port, syslog); // Wait for that log line to show up in NRDB - await waitForLogMessageContaining(nrdb, "abcd"); + await waitForLogMessageContaining(nrdb, uuid); }); }); \ No newline at end of file diff --git a/integration-tests/test-suite/systemd.test.js b/integration-tests/test-suite/systemd.test.js index 51978a15..c881ebca 100644 --- a/integration-tests/test-suite/systemd.test.js +++ b/integration-tests/test-suite/systemd.test.js @@ -54,14 +54,14 @@ describe('SYSTEMD unit input', () => { expect(monitoredSystemdUnit).toMatch(/^ssh|sshd$/); // This is 'ssh' in some distros, 'sshd' in others // Create a unique string so that we can find the log message later - const uuid = "1234"; + const uuid = uuidv4(); // Cause a message with the UUID to be written to journald // Should log something containing "input_userauth_request: invalid user ${uuid} [preauth]" causeJournaldMessageToBeWrittenForSsh(uuid); // Wait for that log line to show up in NRDB - await waitForLogMessageContaining(nrdb, "abcdef"); + await waitForLogMessageContaining(nrdb, uuid); }); }); \ No newline at end of file diff --git a/integration-tests/test-suite/tail.test.js b/integration-tests/test-suite/tail.test.js index 3fa732a9..80feb0cf 100644 --- a/integration-tests/test-suite/tail.test.js +++ b/integration-tests/test-suite/tail.test.js @@ -40,7 +40,7 @@ describe('TAIL input', () => { testOnlyIfSet('MONITORED_FILE')('detects appending to a file', async () => { // Create a string with a unique value in it so that we can find it later - const uuid = "12345"; + const uuid = uuidv4(); const line = `fluent-bit-tests: tail ${uuid}`; // Append that string to our test log file @@ -48,7 +48,7 @@ describe('TAIL input', () => { appendTo(file, line); // Wait for that log line to show up in NRDB - await waitForLogMessageContaining(nrdb, "abcdef"); + await waitForLogMessageContaining(nrdb, uuid); }); }); \ No newline at end of file From f6cca62a5d0396c080f0bf35e12fc49062035a72 Mon Sep 17 00:00:00 2001 From: Himanshu Rai Date: Wed, 11 Sep 2024 11:49:18 +0530 Subject: [PATCH 07/29] testing with jest changes --- integration-tests/test-suite/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/integration-tests/test-suite/package.json b/integration-tests/test-suite/package.json index 0fdfbe56..00d9f140 100644 --- a/integration-tests/test-suite/package.json +++ b/integration-tests/test-suite/package.json @@ -3,7 +3,7 @@ "version": "1.0.0", "description": "Validates fluent bit end-to-end with several configurations", "scripts": { - "test": "jest --verbose" + "test": "jest --verbose --runInBand --detectOpenHandles --forceExit" }, "author": "logging-team@newrelic.com", "license": "Apache-2.0", From 3770b0cefe6c1e0c3880836aec3d932e11f837eb Mon Sep 17 00:00:00 2001 From: Himanshu Rai Date: Wed, 11 Sep 2024 13:58:58 +0530 Subject: [PATCH 08/29] testing with jest changes 2 --- integration-tests/test-suite/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/integration-tests/test-suite/package.json b/integration-tests/test-suite/package.json index 00d9f140..a10a5dfc 100644 --- a/integration-tests/test-suite/package.json +++ b/integration-tests/test-suite/package.json @@ -3,7 +3,7 @@ "version": "1.0.0", "description": "Validates fluent bit end-to-end with several configurations", "scripts": { - "test": "jest --verbose --runInBand --detectOpenHandles --forceExit" + "test": "jest --verbose --runInBand" }, "author": "logging-team@newrelic.com", "license": "Apache-2.0", From 34da17ef727c55f645acbd02f4b92cc5cc13940e Mon Sep 17 00:00:00 2001 From: Himanshu Rai Date: Thu, 12 Sep 2024 14:06:40 +0530 Subject: [PATCH 09/29] testing cleaning of instance --- .github/workflows/run_e2e_tests.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/run_e2e_tests.yml b/.github/workflows/run_e2e_tests.yml index ff0bca00..6f1420f3 100644 --- a/.github/workflows/run_e2e_tests.yml +++ b/.github/workflows/run_e2e_tests.yml @@ -99,6 +99,7 @@ jobs: tear_down_test_executor_instances: name: Tear down test executor instances + if: always() needs: report_test_results uses: ./.github/workflows/run_task.yml with: From 48470c12d8aacedb3f582cf6010b1a46b704e09f Mon Sep 17 00:00:00 2001 From: Himanshu Rai Date: Fri, 13 Sep 2024 00:44:48 +0530 Subject: [PATCH 10/29] test --- .github/workflows/run_e2e_tests.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/run_e2e_tests.yml b/.github/workflows/run_e2e_tests.yml index 6f1420f3..762ff174 100644 --- a/.github/workflows/run_e2e_tests.yml +++ b/.github/workflows/run_e2e_tests.yml @@ -99,7 +99,7 @@ jobs: tear_down_test_executor_instances: name: Tear down test executor instances - if: always() + # if: always() needs: report_test_results uses: ./.github/workflows/run_task.yml with: From e5d0c8a106b1e4601c91dece82c49a2ced41a68d Mon Sep 17 00:00:00 2001 From: Himanshu Rai Date: Fri, 13 Sep 2024 01:59:47 +0530 Subject: [PATCH 11/29] testing terraform stop --- .github/workflows/run_e2e_tests.yml | 2 +- terraform/ec2-instances-creator/main.tf | 4 ++++ terraform/ec2-test-executors/Makefile | 10 ++++++++++ terraform/outputs.tf | 3 +++ 4 files changed, 18 insertions(+), 1 deletion(-) create mode 100644 terraform/outputs.tf diff --git a/.github/workflows/run_e2e_tests.yml b/.github/workflows/run_e2e_tests.yml index 762ff174..65e2a52f 100644 --- a/.github/workflows/run_e2e_tests.yml +++ b/.github/workflows/run_e2e_tests.yml @@ -103,5 +103,5 @@ jobs: needs: report_test_results uses: ./.github/workflows/run_task.yml with: - container_make_target: "terraform/ec2-test-executors/clean PRE_RELEASE_NAME=${{ inputs.gh_release_name }}" + container_make_target: "terraform/ec2-test-executors/stop PRE_RELEASE_NAME=${{ inputs.gh_release_name }}" secrets: inherit diff --git a/terraform/ec2-instances-creator/main.tf b/terraform/ec2-instances-creator/main.tf index 8311ea53..44da4ba7 100644 --- a/terraform/ec2-instances-creator/main.tf +++ b/terraform/ec2-instances-creator/main.tf @@ -71,4 +71,8 @@ module "ec2_instance" { instance_type = var.instance_type fb_package_name = each.value.targetPackageName }) +} + +output "instance_ids" { + value = { for k, v in module.ec2_instance : k => v.this_instance_id } } \ No newline at end of file diff --git a/terraform/ec2-test-executors/Makefile b/terraform/ec2-test-executors/Makefile index 0457facb..1c0e8efc 100644 --- a/terraform/ec2-test-executors/Makefile +++ b/terraform/ec2-test-executors/Makefile @@ -29,3 +29,13 @@ clean: backend vars generateMatrices terraform destroy -auto-approve -var-file="variables.tfvars" @echo "Removing Terraform backend file ${TERRAFORM_PROJECT}/terraform.backend.tf" @rm "./terraform.backend.tf" + + +# Terraform-stop +.PHONY: stop +stop: backend vars generateMatrices + terraform init -reconfigure + @echo "Stopping EC2 instances..." + #aws ec2 stop-instances --instance-ids $(terraform output -raw instance_ids) + aws ec2 stop-instances --instance-ids $(terraform output -json instance_ids | jq -r '.[] | join(" ")') + @echo "EC2 instances stopped." \ No newline at end of file diff --git a/terraform/outputs.tf b/terraform/outputs.tf new file mode 100644 index 00000000..5a40bd6b --- /dev/null +++ b/terraform/outputs.tf @@ -0,0 +1,3 @@ +output "instance_ids" { + value = aws_instance.my_instances[*].id +} \ No newline at end of file From 548ee7d2f4e29b3d978dbd8199d254d090cfa29f Mon Sep 17 00:00:00 2001 From: Himanshu Rai Date: Fri, 13 Sep 2024 02:08:22 +0530 Subject: [PATCH 12/29] assind separator --- terraform/ec2-test-executors/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/terraform/ec2-test-executors/Makefile b/terraform/ec2-test-executors/Makefile index 1c0e8efc..cff402e0 100644 --- a/terraform/ec2-test-executors/Makefile +++ b/terraform/ec2-test-executors/Makefile @@ -34,7 +34,7 @@ clean: backend vars generateMatrices # Terraform-stop .PHONY: stop stop: backend vars generateMatrices - terraform init -reconfigure + terraform init -reconfigure && \ @echo "Stopping EC2 instances..." #aws ec2 stop-instances --instance-ids $(terraform output -raw instance_ids) aws ec2 stop-instances --instance-ids $(terraform output -json instance_ids | jq -r '.[] | join(" ")') From 44bb8d7a8d937b47194a8edfd470514c940450ab Mon Sep 17 00:00:00 2001 From: Himanshu Rai Date: Fri, 13 Sep 2024 02:16:25 +0530 Subject: [PATCH 13/29] adding tab instead of space --- terraform/ec2-test-executors/Makefile | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/terraform/ec2-test-executors/Makefile b/terraform/ec2-test-executors/Makefile index cff402e0..f20edb3b 100644 --- a/terraform/ec2-test-executors/Makefile +++ b/terraform/ec2-test-executors/Makefile @@ -34,8 +34,8 @@ clean: backend vars generateMatrices # Terraform-stop .PHONY: stop stop: backend vars generateMatrices - terraform init -reconfigure && \ - @echo "Stopping EC2 instances..." - #aws ec2 stop-instances --instance-ids $(terraform output -raw instance_ids) - aws ec2 stop-instances --instance-ids $(terraform output -json instance_ids | jq -r '.[] | join(" ")') - @echo "EC2 instances stopped." \ No newline at end of file + terraform init -reconfigure && \ + @echo "Stopping EC2 instances..." + #aws ec2 stop-instances --instance-ids $(terraform output -raw instance_ids) + aws ec2 stop-instances --instance-ids $(terraform output -json instance_ids | jq -r '.[] | join(" ")') + @echo "EC2 instances stopped." \ No newline at end of file From edbca270d389549d92956379de58b23fea7d066b Mon Sep 17 00:00:00 2001 From: Himanshu Rai Date: Fri, 13 Sep 2024 02:32:48 +0530 Subject: [PATCH 14/29] testing with id --- terraform/ec2-instances-creator/main.tf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/terraform/ec2-instances-creator/main.tf b/terraform/ec2-instances-creator/main.tf index 44da4ba7..5b0d4ef7 100644 --- a/terraform/ec2-instances-creator/main.tf +++ b/terraform/ec2-instances-creator/main.tf @@ -74,5 +74,5 @@ module "ec2_instance" { } output "instance_ids" { - value = { for k, v in module.ec2_instance : k => v.this_instance_id } + value = { for k, v in module.ec2_instance : k => v.id } } \ No newline at end of file From 59a8f458da424ebed62f95c441dbfef38ffea1d8 Mon Sep 17 00:00:00 2001 From: Himanshu Rai Date: Fri, 13 Sep 2024 02:51:27 +0530 Subject: [PATCH 15/29] adding always condition --- .github/workflows/run_e2e_tests.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/run_e2e_tests.yml b/.github/workflows/run_e2e_tests.yml index 65e2a52f..01ad00c0 100644 --- a/.github/workflows/run_e2e_tests.yml +++ b/.github/workflows/run_e2e_tests.yml @@ -99,7 +99,7 @@ jobs: tear_down_test_executor_instances: name: Tear down test executor instances - # if: always() + if: always() needs: report_test_results uses: ./.github/workflows/run_task.yml with: From 5fe615b92b0c0c2077cce1c3c3f8e6815a0ec3b5 Mon Sep 17 00:00:00 2001 From: Himanshu Rai Date: Fri, 13 Sep 2024 03:15:35 +0530 Subject: [PATCH 16/29] more debigging --- integration-tests/test-suite/tcp.test.js | 4 ++-- terraform/ec2-test-executors/Makefile | 6 +++++- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/integration-tests/test-suite/tcp.test.js b/integration-tests/test-suite/tcp.test.js index e917d201..573648e3 100644 --- a/integration-tests/test-suite/tcp.test.js +++ b/integration-tests/test-suite/tcp.test.js @@ -62,7 +62,7 @@ describe('TCP input', () => { testOnlyIfSet('MONITORED_TCP_PORT')('detects writing to TCP port', async () => { // Create a string with a unique value in it so that we can find it later - const uuid = "abcdef"; + const uuid = uuidv4(); const line = `fluent-bit-tests: tcp ${uuid}`; // Write that string to the TCP socket @@ -70,7 +70,7 @@ describe('TCP input', () => { writeToTcpSocket(port, line); // Wait for that log line to show up in NRDB - await waitForLogMessageContaining(nrdb, "12345"); + await waitForLogMessageContaining(nrdb, uuid); }); }); \ No newline at end of file diff --git a/terraform/ec2-test-executors/Makefile b/terraform/ec2-test-executors/Makefile index f20edb3b..213fa3b7 100644 --- a/terraform/ec2-test-executors/Makefile +++ b/terraform/ec2-test-executors/Makefile @@ -34,8 +34,12 @@ clean: backend vars generateMatrices # Terraform-stop .PHONY: stop stop: backend vars generateMatrices - terraform init -reconfigure && \ + terraform init -reconfigure ; @echo "Stopping EC2 instances..." + terraform output -raw instance_ids ; + @echo "Output printed..." + terraform output -json instance_ids | jq -r '.[] | join(" ")' ; + @echo "Output printed twice..." #aws ec2 stop-instances --instance-ids $(terraform output -raw instance_ids) aws ec2 stop-instances --instance-ids $(terraform output -json instance_ids | jq -r '.[] | join(" ")') @echo "EC2 instances stopped." \ No newline at end of file From a111ef2068939c2b09e379eabe2acf0ddff4e1f9 Mon Sep 17 00:00:00 2001 From: Himanshu Rai Date: Fri, 13 Sep 2024 03:43:29 +0530 Subject: [PATCH 17/29] more debugging --- terraform/ec2-test-executors/Makefile | 2 ++ 1 file changed, 2 insertions(+) diff --git a/terraform/ec2-test-executors/Makefile b/terraform/ec2-test-executors/Makefile index 213fa3b7..bf4acf52 100644 --- a/terraform/ec2-test-executors/Makefile +++ b/terraform/ec2-test-executors/Makefile @@ -34,9 +34,11 @@ clean: backend vars generateMatrices # Terraform-stop .PHONY: stop stop: backend vars generateMatrices + terraform refresh; terraform init -reconfigure ; @echo "Stopping EC2 instances..." terraform output -raw instance_ids ; + terraform console; @echo "Output printed..." terraform output -json instance_ids | jq -r '.[] | join(" ")' ; @echo "Output printed twice..." From 46da2b8cd9b6e9b1d55f4a576c0e460ad0df0b10 Mon Sep 17 00:00:00 2001 From: Himanshu Rai Date: Fri, 13 Sep 2024 03:59:04 +0530 Subject: [PATCH 18/29] debug --- terraform/ec2-test-executors/Makefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/terraform/ec2-test-executors/Makefile b/terraform/ec2-test-executors/Makefile index bf4acf52..96513717 100644 --- a/terraform/ec2-test-executors/Makefile +++ b/terraform/ec2-test-executors/Makefile @@ -33,9 +33,9 @@ clean: backend vars generateMatrices # Terraform-stop .PHONY: stop -stop: backend vars generateMatrices - terraform refresh; +stop: backend vars generateMatrices terraform init -reconfigure ; + terraform refresh; @echo "Stopping EC2 instances..." terraform output -raw instance_ids ; terraform console; From 74a8e48ff188a331c9930e2932a0ba9dfba0a36e Mon Sep 17 00:00:00 2001 From: Himanshu Rai Date: Fri, 13 Sep 2024 12:59:32 +0530 Subject: [PATCH 19/29] working on local testing on integration --- terraform/ec2-test-executors/Makefile | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/terraform/ec2-test-executors/Makefile b/terraform/ec2-test-executors/Makefile index 96513717..9dc0055b 100644 --- a/terraform/ec2-test-executors/Makefile +++ b/terraform/ec2-test-executors/Makefile @@ -34,14 +34,12 @@ clean: backend vars generateMatrices # Terraform-stop .PHONY: stop stop: backend vars generateMatrices - terraform init -reconfigure ; - terraform refresh; - @echo "Stopping EC2 instances..." - terraform output -raw instance_ids ; - terraform console; - @echo "Output printed..." - terraform output -json instance_ids | jq -r '.[] | join(" ")' ; - @echo "Output printed twice..." + terraform init -reconfigure && \ + @echo "Stopping EC2 instances..." && \ + terraform output instance_ids && \ + @echo "Output printed..." && \ + terraform output -json instance_ids | jq -r '.[]' | paste -sd ' ' - && \ + @echo "Output printed twice..." && \ #aws ec2 stop-instances --instance-ids $(terraform output -raw instance_ids) - aws ec2 stop-instances --instance-ids $(terraform output -json instance_ids | jq -r '.[] | join(" ")') + aws ec2 stop-instances --region us-east-2 --instance-ids $(terraform output -json instance_ids | jq -r '.[]' | paste -sd ' ' -) && \ @echo "EC2 instances stopped." \ No newline at end of file From b516fa1a79ab920b5132e376380db416e563bf25 Mon Sep 17 00:00:00 2001 From: Himanshu Rai Date: Fri, 13 Sep 2024 14:29:39 +0530 Subject: [PATCH 20/29] removing echo --- terraform/ec2-test-executors/Makefile | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/terraform/ec2-test-executors/Makefile b/terraform/ec2-test-executors/Makefile index 9dc0055b..a36b244c 100644 --- a/terraform/ec2-test-executors/Makefile +++ b/terraform/ec2-test-executors/Makefile @@ -35,11 +35,7 @@ clean: backend vars generateMatrices .PHONY: stop stop: backend vars generateMatrices terraform init -reconfigure && \ - @echo "Stopping EC2 instances..." && \ terraform output instance_ids && \ - @echo "Output printed..." && \ terraform output -json instance_ids | jq -r '.[]' | paste -sd ' ' - && \ - @echo "Output printed twice..." && \ - #aws ec2 stop-instances --instance-ids $(terraform output -raw instance_ids) - aws ec2 stop-instances --region us-east-2 --instance-ids $(terraform output -json instance_ids | jq -r '.[]' | paste -sd ' ' -) && \ + aws ec2 stop-instances --region us-east-2 --instance-ids $(terraform output -json instance_ids | jq -r '.[]' | paste -sd ' ' -) ; @echo "EC2 instances stopped." \ No newline at end of file From 50e003277656c7b45b8d637d29e0ab48332dfb84 Mon Sep 17 00:00:00 2001 From: Himanshu Rai Date: Fri, 13 Sep 2024 14:55:50 +0530 Subject: [PATCH 21/29] adding refresh --- terraform/ec2-test-executors/Makefile | 1 + 1 file changed, 1 insertion(+) diff --git a/terraform/ec2-test-executors/Makefile b/terraform/ec2-test-executors/Makefile index a36b244c..b1ecd7b8 100644 --- a/terraform/ec2-test-executors/Makefile +++ b/terraform/ec2-test-executors/Makefile @@ -35,6 +35,7 @@ clean: backend vars generateMatrices .PHONY: stop stop: backend vars generateMatrices terraform init -reconfigure && \ + terraform refresh && \ terraform output instance_ids && \ terraform output -json instance_ids | jq -r '.[]' | paste -sd ' ' - && \ aws ec2 stop-instances --region us-east-2 --instance-ids $(terraform output -json instance_ids | jq -r '.[]' | paste -sd ' ' -) ; From c9484b20476544b3ae03998508803c6fa2c39a28 Mon Sep 17 00:00:00 2001 From: Himanshu Rai Date: Fri, 13 Sep 2024 15:15:51 +0530 Subject: [PATCH 22/29] removing vars --- terraform/ec2-test-executors/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/terraform/ec2-test-executors/Makefile b/terraform/ec2-test-executors/Makefile index b1ecd7b8..4439cda7 100644 --- a/terraform/ec2-test-executors/Makefile +++ b/terraform/ec2-test-executors/Makefile @@ -33,7 +33,7 @@ clean: backend vars generateMatrices # Terraform-stop .PHONY: stop -stop: backend vars generateMatrices +stop: backend generateMatrices terraform init -reconfigure && \ terraform refresh && \ terraform output instance_ids && \ From 5b6ea36ded91f81d4609057cda0bd14213e7ce47 Mon Sep 17 00:00:00 2001 From: Himanshu Rai Date: Fri, 13 Sep 2024 15:29:51 +0530 Subject: [PATCH 23/29] removing backed and vars --- terraform/ec2-test-executors/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/terraform/ec2-test-executors/Makefile b/terraform/ec2-test-executors/Makefile index 4439cda7..01e2e962 100644 --- a/terraform/ec2-test-executors/Makefile +++ b/terraform/ec2-test-executors/Makefile @@ -33,7 +33,7 @@ clean: backend vars generateMatrices # Terraform-stop .PHONY: stop -stop: backend generateMatrices +stop: terraform init -reconfigure && \ terraform refresh && \ terraform output instance_ids && \ From 49dddeb69436dbdea9d80ae2b0f6ec3f8be854ea Mon Sep 17 00:00:00 2001 From: Himanshu Rai Date: Fri, 13 Sep 2024 15:47:23 +0530 Subject: [PATCH 24/29] more debug --- terraform/ec2-test-executors/Makefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/terraform/ec2-test-executors/Makefile b/terraform/ec2-test-executors/Makefile index 01e2e962..fd39d9ca 100644 --- a/terraform/ec2-test-executors/Makefile +++ b/terraform/ec2-test-executors/Makefile @@ -33,9 +33,9 @@ clean: backend vars generateMatrices # Terraform-stop .PHONY: stop -stop: +stop: backend vars generateMatrices terraform init -reconfigure && \ - terraform refresh && \ + terraform refresh -auto-approve -var-file="variables.tfvars && \ terraform output instance_ids && \ terraform output -json instance_ids | jq -r '.[]' | paste -sd ' ' - && \ aws ec2 stop-instances --region us-east-2 --instance-ids $(terraform output -json instance_ids | jq -r '.[]' | paste -sd ' ' -) ; From 527c665047bfc9cc7bd85a9ba56716b12cff52b1 Mon Sep 17 00:00:00 2001 From: Himanshu Rai Date: Fri, 13 Sep 2024 16:04:56 +0530 Subject: [PATCH 25/29] removing all the output debug msgs --- terraform/ec2-test-executors/Makefile | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/terraform/ec2-test-executors/Makefile b/terraform/ec2-test-executors/Makefile index fd39d9ca..6f53920e 100644 --- a/terraform/ec2-test-executors/Makefile +++ b/terraform/ec2-test-executors/Makefile @@ -35,8 +35,6 @@ clean: backend vars generateMatrices .PHONY: stop stop: backend vars generateMatrices terraform init -reconfigure && \ - terraform refresh -auto-approve -var-file="variables.tfvars && \ - terraform output instance_ids && \ - terraform output -json instance_ids | jq -r '.[]' | paste -sd ' ' - && \ + terraform refresh -auto-approve -var-file="variables.tfvars" aws ec2 stop-instances --region us-east-2 --instance-ids $(terraform output -json instance_ids | jq -r '.[]' | paste -sd ' ' -) ; @echo "EC2 instances stopped." \ No newline at end of file From 066f5adf4418f8270b62a232e491c26daafad4b6 Mon Sep 17 00:00:00 2001 From: Himanshu Rai Date: Fri, 13 Sep 2024 16:22:45 +0530 Subject: [PATCH 26/29] final try --- .github/workflows/run_e2e_tests.yml | 2 +- terraform/ec2-test-executors/Makefile | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/run_e2e_tests.yml b/.github/workflows/run_e2e_tests.yml index 01ad00c0..647d2e93 100644 --- a/.github/workflows/run_e2e_tests.yml +++ b/.github/workflows/run_e2e_tests.yml @@ -103,5 +103,5 @@ jobs: needs: report_test_results uses: ./.github/workflows/run_task.yml with: - container_make_target: "terraform/ec2-test-executors/stop PRE_RELEASE_NAME=${{ inputs.gh_release_name }}" + container_make_target: "terraform/ec2-test-executors/stop" secrets: inherit diff --git a/terraform/ec2-test-executors/Makefile b/terraform/ec2-test-executors/Makefile index 6f53920e..0aec1f18 100644 --- a/terraform/ec2-test-executors/Makefile +++ b/terraform/ec2-test-executors/Makefile @@ -33,8 +33,8 @@ clean: backend vars generateMatrices # Terraform-stop .PHONY: stop -stop: backend vars generateMatrices +stop: terraform init -reconfigure && \ - terraform refresh -auto-approve -var-file="variables.tfvars" + terraform refresh " aws ec2 stop-instances --region us-east-2 --instance-ids $(terraform output -json instance_ids | jq -r '.[]' | paste -sd ' ' -) ; @echo "EC2 instances stopped." \ No newline at end of file From 6cdde5e64e523fb5c63f02f04f256043e3a4e21a Mon Sep 17 00:00:00 2001 From: Himanshu Rai Date: Fri, 13 Sep 2024 16:36:07 +0530 Subject: [PATCH 27/29] removing the error --- terraform/ec2-test-executors/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/terraform/ec2-test-executors/Makefile b/terraform/ec2-test-executors/Makefile index 0aec1f18..fa0a9c7b 100644 --- a/terraform/ec2-test-executors/Makefile +++ b/terraform/ec2-test-executors/Makefile @@ -35,6 +35,6 @@ clean: backend vars generateMatrices .PHONY: stop stop: terraform init -reconfigure && \ - terraform refresh " + terraform refresh aws ec2 stop-instances --region us-east-2 --instance-ids $(terraform output -json instance_ids | jq -r '.[]' | paste -sd ' ' -) ; @echo "EC2 instances stopped." \ No newline at end of file From 0c96f3d3e874dd9937f83649a921cb7a22c8d86f Mon Sep 17 00:00:00 2001 From: Himanshu Rai Date: Fri, 13 Sep 2024 16:55:47 +0530 Subject: [PATCH 28/29] adding everything --- .github/workflows/run_e2e_tests.yml | 2 +- terraform/ec2-test-executors/Makefile | 3 ++- terraform/outputs.tf | 3 ++- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/.github/workflows/run_e2e_tests.yml b/.github/workflows/run_e2e_tests.yml index 647d2e93..01ad00c0 100644 --- a/.github/workflows/run_e2e_tests.yml +++ b/.github/workflows/run_e2e_tests.yml @@ -103,5 +103,5 @@ jobs: needs: report_test_results uses: ./.github/workflows/run_task.yml with: - container_make_target: "terraform/ec2-test-executors/stop" + container_make_target: "terraform/ec2-test-executors/stop PRE_RELEASE_NAME=${{ inputs.gh_release_name }}" secrets: inherit diff --git a/terraform/ec2-test-executors/Makefile b/terraform/ec2-test-executors/Makefile index fa0a9c7b..014440cb 100644 --- a/terraform/ec2-test-executors/Makefile +++ b/terraform/ec2-test-executors/Makefile @@ -33,8 +33,9 @@ clean: backend vars generateMatrices # Terraform-stop .PHONY: stop -stop: +stop: backend vars generateMatrices terraform init -reconfigure && \ + terraform apply -auto-approve -var-file="variables.tfvars" && \ terraform refresh aws ec2 stop-instances --region us-east-2 --instance-ids $(terraform output -json instance_ids | jq -r '.[]' | paste -sd ' ' -) ; @echo "EC2 instances stopped." \ No newline at end of file diff --git a/terraform/outputs.tf b/terraform/outputs.tf index 5a40bd6b..795a171d 100644 --- a/terraform/outputs.tf +++ b/terraform/outputs.tf @@ -1,3 +1,4 @@ output "instance_ids" { - value = aws_instance.my_instances[*].id + description = "A map of instance IDs created by the ec2_instance module" + value = { for k, v in module.ec2_instance : k => v.id } } \ No newline at end of file From a3b4257d565d811a684acda3927c6952ff91a762 Mon Sep 17 00:00:00 2001 From: Himanshu Rai Date: Fri, 13 Sep 2024 18:22:53 +0530 Subject: [PATCH 29/29] separating logic to stop --- .github/workflows/run_e2e_tests.yml | 9 ++++++++- terraform/ec2-stop-instances/Makefile | 7 +++++++ 2 files changed, 15 insertions(+), 1 deletion(-) create mode 100644 terraform/ec2-stop-instances/Makefile diff --git a/.github/workflows/run_e2e_tests.yml b/.github/workflows/run_e2e_tests.yml index 01ad00c0..9d789786 100644 --- a/.github/workflows/run_e2e_tests.yml +++ b/.github/workflows/run_e2e_tests.yml @@ -97,9 +97,16 @@ jobs: files: | ${{ inputs.test_report_filename }} + stop_executor_instances: + name: stop test executor instances + if: always() + uses: ./.github/workflows/run_task.yml + with: + container_make_target: "terraform/ec2-stop-instances/stop" + secrets: inherit + tear_down_test_executor_instances: name: Tear down test executor instances - if: always() needs: report_test_results uses: ./.github/workflows/run_task.yml with: diff --git a/terraform/ec2-stop-instances/Makefile b/terraform/ec2-stop-instances/Makefile new file mode 100644 index 00000000..e965e75c --- /dev/null +++ b/terraform/ec2-stop-instances/Makefile @@ -0,0 +1,7 @@ +# Terraform-stop +.PHONY: stop +stop: + terraform init -reconfigure && \ + terraform refresh + aws ec2 stop-instances --region us-east-2 --instance-ids $(terraform output -json instance_ids | jq -r '.[]' | paste -sd ' ' -) ; + @echo "EC2 instances stopped." \ No newline at end of file