Coder Social home page Coder Social logo

purpleclay / testcontainers-imds Goto Github PK

View Code? Open in Web Editor NEW
0.0 3.0 0.0 349 KB

Testcontainers wrapper for the Instance Metadata Mock (imds-mock) tool. Quickly and easily simulate IMDS for localised testing

License: MIT License

Go 100.00%
aws aws-imdsv1 aws-imdsv2 ec2-instance-metadata ec2-instance-metadata-mock testcontainers testcontainers-go

testcontainers-imds's Introduction

Hi there ๐Ÿ‘‹

Building tools to make developers' lives easier is my passion

testcontainers-imds's People

Contributors

dependabot[bot] avatar purpleclay avatar

Watchers

 avatar  avatar  avatar

testcontainers-imds's Issues

[Feature]: stay in sync with the latest AEMM mock by publishing custom container

Describe your feature

The amazon-ec2-metadata-mock doesn't publish images with the latest tag. So there is a good change that this library will get out of sync with the latest version.

Your potential solution

By adding a custom Dockerfile to this project and publishing it to the GHCR, a tool such as dependabot can be used to patch the version and raise a PR whenever a new version has been published.

If this PR is then auto-merged, a new container can be published automatically. Switch the reference image within the code to use the GHCR public image instead.

Any additional information?

No response

Code of Conduct

  • I agree to follow this project's Code of Conduct

[Feature]: expand options to support latest imds-mock features

Describe your feature

Having switched to using the imds-mock tool. The testcontainers library should be updated to support the following features:

  • Pretty Printing of JSON responses
  • Instance Tags
  • Spot Instance Interruption Notice

Your potential solution

Expand the existing options and pass as required into the underlying image.

Any additional information?

No response

Code of Conduct

  • I agree to follow this project's Code of Conduct

[Feature]: expose the URLs generated on startup as immutable references for use within tests

Describe your feature

When the IMDS container is currently launched, the URLs for both the metadata and token endpoints are auto-generated but not exposed to any test code. Unfortunately, this makes testing a little cumbersome as the URL needs to be provided within tests.

Your potential solution

Expose two methods on the container that returns a copy of the URLs, ensuring they remain immutable within the container itself. This will ensure all utility methods behave as expected.

Any additional information?

No response

Code of Conduct

  • I agree to follow this project's Code of Conduct

[Feature]: Remove the need to handle an error when launching the container

Describe your feature

Test code could be simplified further by not having to always handle the error that is returned by the underlying testcontainers-go library.

Your potential solution

Add additional methods MustContainer and MustContainerWith that will panic on any failures when launching the underlying container. This will remove the need to handle any errors within the test code, at the expense of a panic being raised.

Any additional information?

No response

Code of Conduct

  • I agree to follow this project's Code of Conduct

[Feature]: enable toggling of strict IMDSv2 only

Describe your feature

By default, AEMM supports both IMDSv1 and IMDSv2. However, the best practice by AWS mandates the use of IMDSv2. Provide an option to start up the container with IMDSv2 only support

Your potential solution

IMDSv2 can be enforced through the --imdsv2 flag when starting up the container.

Any additional information?

No response

Code of Conduct

  • I agree to follow this project's Code of Conduct

[Feature]: Simplify assertions by providing constant lookup values for the AEMM mock

Describe your feature

The AEMM container will always return a set of static values. To make these easier to assert against, these values should be exposed by the library as constants.

Your potential solution

Define a list of paths and their respective values if querying the AEMM mock through any tests.

Any additional information?

No response

Code of Conduct

  • I agree to follow this project's Code of Conduct

[Feature]: expose URL of container after it has launched for easier testing

Describe your feature

After the AEMM container is launched, any test code calling the container must hardcode the URL. Exposing this through the returned container would simplify testing.

Your potential solution

The returned container should wrap the testcontainers.Container interface, exposing an additional URL function.

type AEMMContainer struct {
    testcontainers.Container
    URL string
}

Any additional information?

No response

Code of Conduct

  • I agree to follow this project's Code of Conduct

[Feature]: switch to using imds-mock

Describe your feature

Switch to using the PurpleClay imds-mock rather than the existing Amazon EC2 Metadata Mock (AEMM).

Your potential solution

Switch to using the PurpleClay imds-mock rather than the existing Amazon EC2 Metadata Mock (AEMM).

Any additional information?

No response

Code of Conduct

  • I agree to follow this project's Code of Conduct

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.