localstack / localstack-terraform-test

Utilities to run Terraform tests against LocalStack

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Lambda test setup broken due to unavailable test fixtures

joe4dev opened this issue Β· comments

The Lambda coverage page in our docs does not show any βœ… for "External Test Suite" nor "Terraform Validated" (except for ListEventSourceMappings presumably covered somewhere else). The hug gap in the middle looks bad 😒
Screenshot 2023-07-11 at 18 01 24

The logs of the latest run indicate an issue in the test setup:

 =================================== FAILURES ===================================
________________ Test Case: TestAccLambdaAliasDataSource_basic _________________
Execution failed with return code: 256
Failure Reason:
=== RUN   TestAccLambdaAliasDataSource_basic
=== PAUSE TestAccLambdaAliasDataSource_basic
=== CONT  TestAccLambdaAliasDataSource_basic
    alias_data_source_test.go:19: Step 1/1 error: Error running apply: exit status 1
        
        Error: unable to load "test-fixtures/lambdatest.zip": open test-fixtures/lambdatest.zip: no such file or directory
        
          with aws_lambda_function.test,
          on terraform_plugin_test.tf line 57, in resource "aws_lambda_function" "test":
          57: resource "aws_lambda_function" "test" {
        
--- FAIL: TestAccLambdaAliasDataSource_basic (13.27s)
FAIL

It appears that the lambda test fixtures are not available:
Error: unable to load "test-fixtures/lambdatest.zip": open test-fixtures/lambdatest.zip: no such file or directory
Therefore, all Lambda tests fail.

@macnev2013
/cc @steffyP

I disabled the moto tests for lambda a few weeks ago, because they blocked the entire test pipeline. Seemed to becaused by new iam rules we enforce in LS, and were not honored by the moto test.
If the terraform tests work again, the "external test suite" will be checked again :)

Thank you for the context @steffyP

Seemed to becaused by new iam rules we enforce in LS, and were not honored by the moto test.

I see. Probably not worth fixing and better disabling IAM enforcement for them because they are not designed with IAM in mind.


@macnev2013 Did the TF lambda tests ever work? Any idea what's broken in the TF test setup?

@joe4dev: We are keeping track of the successful amount of test cases for this terraform-testing project, and it seems like for lambda there were only 5 test cases working in the past (and still are).

Regarding the moto tests: no, it doesn't make any sense to "fix" them. The only intention behind the moto-test project was to get some more test coverage for all services/operations that only rely on the moto fallback implementation and are therefore not tested in LocalStack explicitly.

We could think about removing the column "external test suite" for services where we already have a high internal test coverage, and no/little external tests.

it seems like for lambda there were only 5 test cases working in the past (and still are).

These 5 tests have little to do with Lambda itself (e.g., doing some parameter validations). It seems the Lambda tests never worked because the deployment package is missing (i.e., "test-fixtures/lambdatest.zip").