diff --git a/newrelic_lambda_cli/subscriptions.py b/newrelic_lambda_cli/subscriptions.py index 0065d46..dce4966 100644 --- a/newrelic_lambda_cli/subscriptions.py +++ b/newrelic_lambda_cli/subscriptions.py @@ -100,8 +100,8 @@ def create_log_subscription(input, function_name): destination = get_newrelic_log_ingestion_function(input.session, input.stackname) if destination is None: failure( - "Could not find newrelic-log-ingestion function. Is the New Relic AWS " - "integration installed?" + "Could not find newrelic-log-ingestion function in stack: %s. Is the New Relic AWS " + "integration installed?" % input.stackname ) return False destination_arn = destination["Configuration"]["FunctionArn"] diff --git a/tests/cli/test_subscriptions.py b/tests/cli/test_subscriptions.py index 9338135..366712b 100644 --- a/tests/cli/test_subscriptions.py +++ b/tests/cli/test_subscriptions.py @@ -32,7 +32,7 @@ def test_subscriptions_install(aws_credentials, cli_runner): assert result.exit_code == 1 assert result.stdout == "" assert ( - "Could not find newrelic-log-ingestion function. " + "Could not find newrelic-log-ingestion function in stack: NewRelicLogIngestion. " "Is the New Relic AWS integration installed?" ) in result.stderr @@ -60,10 +60,40 @@ def test_subscriptions_install(aws_credentials, cli_runner): assert result2.exit_code == 1 assert result2.stdout == "" assert ( - "Could not find newrelic-log-ingestion function. " + "Could not find newrelic-log-ingestion function in stack: NewRelicLogIngestion. " "Is the New Relic AWS integration installed?" ) in result2.stderr + result3 = cli_runner.invoke( + cli, + [ + "subscriptions", + "install", + "--no-aws-permissions-check", + "--function", + "foobar", + "--function", + "barbaz", + "--aws-region", + "us-east-1", + "--stackname", + "MyCustomStackName", + ], + env={ + "AWS_ACCESS_KEY_ID": "testing", + "AWS_SECRET_ACCESS_KEY": "testing", + "AWS_SECURITY_TOKEN": "testing", + "AWS_SESSION_TOKEN": "testing", + }, + ) + + assert result3.exit_code == 1 + assert result3.stdout == "" + assert ( + "Could not find newrelic-log-ingestion function in stack: MyCustomStackName. " + "Is the New Relic AWS integration installed?" + ) in result3.stderr + @mock_aws def test_subscriptions_uninstall(aws_credentials, cli_runner):