diff --git a/test/definitions/super-agent/suse/suse154-super-agent.json b/test/definitions/super-agent/suse/suse154-super-agent.json index b5e19926c..f521c1e14 100644 --- a/test/definitions/super-agent/suse/suse154-super-agent.json +++ b/test/definitions/super-agent/suse/suse154-super-agent.json @@ -1,35 +1,34 @@ { - "global_tags": { - "owning_team": "virtuoso", - "Environment": "development", - "Department": "product", - "Product": "virtuoso" - }, + "global_tags": { + "owning_team": "virtuoso", + "Environment": "development", + "Department": "product", + "Product": "virtuoso" + }, + "resources": [ + { + "id": "host1", + "provider": "aws", + "type": "ec2", + "size": "t3.nano", + "ami_name": "suse-sles-15-sp4-chost-byos-v????????-hvm-ssd-x86_64" + } + ], + "instrumentations": { "resources": [ - { - "id": "host1", - "provider": "aws", - "type": "ec2", - "size": "t3.nano", - "ami_name": "suse-sles-15-sp4-chost-byos-v????????-hvm-ssd-x86_64" + { + "id": "nr_super_agent", + "resource_ids": ["host1"], + "provider": "newrelic", + "source_repository": "https://github.com/newrelic/open-install-library.git", + "deploy_script_path": "test/deploy/linux/newrelic-cli/install-recipe/roles", + "params": { + "recipe_content_url": "https://raw.githubusercontent.com/newrelic/open-install-library/main/recipes/newrelic/infrastructure/super-agent/suse.yml", + "validate_output": "New Relic Super Agent\\s+\\(installed\\)", + "recipe_targeted": "super-agent", + "use_organization_id": true } - ], - "instrumentations": { - "resources": [ - { - "id": "nr_super_agent", - "resource_ids": [ - "host1" - ], - "provider": "newrelic", - "source_repository": "https://github.com/newrelic/open-install-library.git", - "deploy_script_path": "test/deploy/linux/newrelic-cli/install-recipe/roles", - "params": { - "recipe_content_url": "https://raw.githubusercontent.com/newrelic/open-install-library/main/recipes/newrelic/infrastructure/super-agent/suse.yml", - "validate_output": "New Relic Super Agent\\s+\\(installed\\)", - "recipe_targeted": "super-agent" - } - } - ] - } + } + ] + } } diff --git a/test/deploy/linux/newrelic-cli/install-recipe/roles/onafterstart/tasks/main.yml b/test/deploy/linux/newrelic-cli/install-recipe/roles/onafterstart/tasks/main.yml index 6f1049cda..70ff9c0eb 100644 --- a/test/deploy/linux/newrelic-cli/install-recipe/roles/onafterstart/tasks/main.yml +++ b/test/deploy/linux/newrelic-cli/install-recipe/roles/onafterstart/tasks/main.yml @@ -7,6 +7,8 @@ # newrelic_cli_path: (optional) The newrelic-cli to use instead of using latest published # command_should_fail: (optional) Should the newrelic install command fail? False by default. # validate_output: (optional) An array of Strings that must appear in stdout for this test to pass. +# use_organization_id: (optional) A boolean value to control if NEW_RELIC_ORGANIZATION_ID should be added to env_vars. False by default. +# newrelic_organization_id: (optional) The NewRelic Organization ID if use_organization_id is set to True. - name: Prepare command_should_fail option when: command_should_fail is not defined @@ -57,6 +59,11 @@ - name: Adding sudo user environment variable set_fact: env_vars: "{{ env_vars }} SUDO_USER={{ ansible_user }}" + +- name: Adding newrelic organization environment variable + set_fact: + env_vars: "{{ env_vars }} NEW_RELIC_ORGANIZATION={{ newrelic_organization_id }}" + when: use_organization_id | bool == True - name: Get CLI environment variables shell: "/bin/bash -ic 'env' | grep NR_CLI_" @@ -166,4 +173,6 @@ - fail: msg: "Failed to validate that {{ validate_output }} is in output:{{ output.stdout }}" when: validate_output is defined and output.stdout is not search(validate_output) - when: command_should_fail == False \ No newline at end of file + when: command_should_fail == False + when: validate_output is defined and output.stdout is not search(validate_output) + when: command_should_fail == False