Skip to content

Tech debt: Audit unit tests and replace external dependencies by mocks #1932

Open
@phipag

Description

@phipag

Why is this needed?

Currently, some unit tests such as powertools-idempotency-dynamodb depend on running a local server for mocking AWS resources.

This violates the principle that unit tests should run in a self-contained way.

Example which should be avoided:

dynamoProxy = ServerRunner.createServerFromCommandLineArgs(new String[] {
"-inMemory",
"-port",
Integer.toString(port)
});
dynamoProxy.start();

This starts a DynamoDB mock server on localhost.

Which area does this relate to?

Tests

Suggestion

This issues suggests to:

  1. Audit all unit tests for external dependencies
  2. Replace external dependencies by self-contained mocking
  3. Add a test scenario in the end2end tests to cover the use-case using real infrastructure in real AWS accounts

Acknowledgment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    Status

    Backlog

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions