Skip to content

Add OpenTofu provider OCI artifact integration test#589

Closed
Copilot wants to merge 4 commits intomainfrom
copilot/add-integration-test-opentofu
Closed

Add OpenTofu provider OCI artifact integration test#589
Copilot wants to merge 4 commits intomainfrom
copilot/add-integration-test-opentofu

Conversation

Copy link
Contributor

Copilot AI commented Feb 23, 2026

Description

Adds OpenTofuITCase to demonstrate assembling an OpenTofu provider artifact per the OCI provider mirror spec. The test covers the full assembly flow: a platform-specific manifest pushed to the registry, then referenced in an OCI image index.

New files:

  • OpenTofuITCase.java — integration test with shouldAssembleOpenTofuProviderArtifact, following the same pattern as HelmITCase/FluxCDITCase
  • terraform-provider-aws_5.0.0_linux_amd64.zip — minimal test fixture simulating a provider binary

Key changes:

  • Both the Manifest and the Index use artifactType = "application/vnd.opentofu.provider" so that OpenTofu can recognize them as representing a provider release
  • The Config is left as Config.empty() (no media type override)
  • Added Index.withArtifactType(String) fluent method to support setting artifact type on an index
  • Added unit test IndexTest#shouldAddArtifactType covering the new method

Key flow:

// linux/amd64 manifest with artifactType
Config config = Config.empty();
Layer layer = Layer.fromFile(providerZip).withMediaType("application/zip");
Manifest manifest = Manifest.empty()
        .withArtifactType(ArtifactType.from("application/vnd.opentofu.provider"))
        .withConfig(config)
        .withLayers(List.of(layer));
Manifest pushedManifest = registry.pushManifest(manifestRef, manifest);

// Index referencing the platform manifest, also with artifactType
ManifestDescriptor descriptor = pushedManifest.getDescriptor().withPlatform(Platform.linuxAmd64());
Index index = Index.fromManifests(List.of(descriptor))
        .withArtifactType("application/vnd.opentofu.provider");
Index pushedIndex = registry.pushIndex(indexRef, index);

assertNotNull(pushedIndex.findUnique(Platform.linuxAmd64()));

Testing done

OpenTofuITCase#shouldAssembleOpenTofuProviderArtifact runs against a local Zot registry via Testcontainers, verifying the manifest and index are pushed and the index resolves the linux/amd64 platform entry. IndexTest#shouldAddArtifactType unit-tests the new Index.withArtifactType method.

Submitter checklist

  • I have read and understood the CONTRIBUTING guide
  • I have run mvn license:update-file-header, mvn spotless:apply, pre-commit run -a, mvn clean install before opening the PR

✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

Copilot AI and others added 2 commits February 23, 2026 13:05
Co-authored-by: jonesbusy <825750+jonesbusy@users.noreply.github.com>
Co-authored-by: jonesbusy <825750+jonesbusy@users.noreply.github.com>
Copilot AI changed the title [WIP] Add integration test for OpenTofu provider assembly Add OpenTofu provider OCI artifact integration test Feb 23, 2026
Copilot AI requested a review from jonesbusy February 23, 2026 13:06
@jonesbusy
Copy link
Collaborator

@copilot

This part is incorrect The index manifest must have its artifactType property set to application/vnd.opentofu.provider so that OpenTofu can recognize is as a representing a provider release

Please use the artifact type for both Manifest and Index.

Not the config media type (we can leave it empty)

Co-authored-by: jonesbusy <825750+jonesbusy@users.noreply.github.com>
Copy link
Contributor Author

Copilot AI commented Feb 23, 2026

@copilot

This part is incorrect `The index manifest must have its artifactType property set to application/vnd.opentofu.provider so that OpenTofu can recognize is as a representing a provider rele...

Fixed in 9bf5969. Both Manifest and Index now use artifactType = "application/vnd.opentofu.provider". The config is left as Config.empty() (no media type). I also added Index.withArtifactType(String) to support setting the artifact type on an index and covered it with a unit test in IndexTest.

@jonesbusy jonesbusy closed this Feb 23, 2026
@jonesbusy jonesbusy deleted the copilot/add-integration-test-opentofu branch February 23, 2026 16:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants