@Test
  public void testExecute_multiPlatformBuild()
      throws IOException, VerificationException, RegistryException {
    String targetImage = dockerHost + ":5000/multiplatform:maven" + System.nanoTime();

    Verifier verifier = new Verifier(simpleTestProject.getProjectRoot().toString());
    verifier.setSystemProperty("_TARGET_IMAGE", targetImage);

    verifier.setSystemProperty("jib.to.auth.username", "testuser");
    verifier.setSystemProperty("jib.to.auth.password", "testpassword");
    verifier.setSystemProperty("sendCredentialsOverHttp", "true");
    verifier.setSystemProperty("jib.allowInsecureRegistries", "true");

    verifier.setAutoclean(false);
    verifier.addCliOption("--file=pom-multiplatform-build.xml");
    verifier.executeGoals(Arrays.asList("clean", "compile", "jib:build"));
    verifier.verifyErrorFreeLog();

    FailoverHttpClient httpClient = new FailoverHttpClient(true, true, ignored -> {});
    RegistryClient registryClient =
        RegistryClient.factory(
                EventHandlers.NONE, dockerHost + ":5000", "multiplatform", httpClient)
            .setCredential(Credential.from("testuser", "testpassword"))
            .newRegistryClient();
    registryClient.configureBasicAuth();

    // manifest list by tag ":latest"
    ManifestTemplate manifestList = registryClient.pullManifest("latest").getManifest();
    assertThat(manifestList).isInstanceOf(V22ManifestListTemplate.class);
    V22ManifestListTemplate v22ManifestList = (V22ManifestListTemplate) manifestList;

    assertThat(v22ManifestList.getManifests().size()).isEqualTo(2);
    ManifestDescriptorTemplate.Platform platform1 =
        v22ManifestList.getManifests().get(0).getPlatform();
    ManifestDescriptorTemplate.Platform platform2 =
        v22ManifestList.getManifests().get(1).getPlatform();

    assertThat(platform1.getArchitecture()).isEqualTo("arm64");
    assertThat(platform1.getOs()).isEqualTo("linux");
    assertThat(platform2.getArchitecture()).isEqualTo("amd64");
    assertThat(platform2.getOs()).isEqualTo("linux");

    // manifest list by tag ":another"
    ManifestTemplate anotherManifestList = registryClient.pullManifest("another").getManifest();
    assertThat(JsonTemplateMapper.toUtf8String(anotherManifestList))
        .isEqualTo(JsonTemplateMapper.toUtf8String(manifestList));

    // Check arm64/linux container config.
    List<String> arm64Digests = v22ManifestList.getDigestsForPlatform("arm64", "linux");
    assertThat(arm64Digests.size()).isEqualTo(1);
    String arm64Digest = arm64Digests.get(0);

    ManifestTemplate arm64Manifest = registryClient.pullManifest(arm64Digest).getManifest();
    assertThat(arm64Manifest).isInstanceOf(V22ManifestTemplate.class);
    V22ManifestTemplate arm64V22Manifest = (V22ManifestTemplate) arm64Manifest;
    DescriptorDigest arm64ConfigDigest = arm64V22Manifest.getContainerConfiguration().getDigest();

    Blob arm64ConfigBlob = registryClient.pullBlob(arm64ConfigDigest, ignored -> {}, ignored -> {});
    String arm64Config = Blobs.writeToString(arm64ConfigBlob);
    assertThat(arm64Config).contains("\"architecture\":\"arm64\"");
    assertThat(arm64Config).contains("\"os\":\"linux\"");

    // Check amd64/linux container config.
    List<String> amd64Digests = v22ManifestList.getDigestsForPlatform("amd64", "linux");
    assertThat(amd64Digests.size()).isEqualTo(1);
    String amd64Digest = amd64Digests.get(0);

    ManifestTemplate amd64Manifest = registryClient.pullManifest(amd64Digest).getManifest();
    assertThat(amd64Manifest).isInstanceOf(V22ManifestTemplate.class);
    V22ManifestTemplate amd64V22Manifest = (V22ManifestTemplate) amd64Manifest;
    DescriptorDigest amd64ConfigDigest = amd64V22Manifest.getContainerConfiguration().getDigest();

    Blob amd64ConfigBlob = registryClient.pullBlob(amd64ConfigDigest, ignored -> {}, ignored -> {});
    String amd64Config = Blobs.writeToString(amd64ConfigBlob);
    assertThat(amd64Config).contains("\"architecture\":\"amd64\"");
    assertThat(amd64Config).contains("\"os\":\"linux\"");
  }
Pulls a built image and attempts to run it. Also verifies the container configuration and
history of the built image.

@param imageReference the image reference of the built image
@return the container output
@throws IOException if an I/O exception occurs
@throws InterruptedException if the process was interrupted
jib-maven-plugin/src/integration-test/java/com/google/cloud/tools/jib/maven/BuildImageMojoIntegrationTest.java