Skip to content

Commit

Permalink
added test for verify builder config is looked up by builder name low…
Browse files Browse the repository at this point in the history
…er cased.
  • Loading branch information
Amitrei authored Jan 4, 2025
1 parent d1fc364 commit 1412c5a
Showing 1 changed file with 21 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,17 @@

import java.io.File;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import java.util.function.BiConsumer;

import static org.junit.jupiter.api.Assertions.assertFalse;
import static org.junit.jupiter.api.Assertions.assertTrue;
import static org.mockito.ArgumentMatchers.eq;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.verify;

class BuildXServiceCreateBuilderTest {
private BuildXService buildXService;
Expand Down Expand Up @@ -60,6 +63,24 @@ void driverOptIsPresentIfProvided() throws Exception {
verifyBuildXArgumentContains("--driver-opt", "network=foonet");
}



@Test
void builderPathWithLowerCasedBuilderName() throws Exception {
String builderName = "myTestBuilder";
Path configPathSpy = Mockito.spy(configPath);
Path expectedPath = Paths.get("buildx","instances",builderName.toLowerCase());

//Given
buildConfigUsingBuildX(temporaryFolder,(buildX, buildImage) -> buildX.builderName(builderName));

// When
buildXService.createBuilder(configPathSpy, Arrays.asList("docker", "buildx"), imageConfig, buildDirs);

// Then
verify(configPathSpy).resolve(eq(expectedPath));
}

@Test
void driverOptIsAbsentIfNotProvided() throws Exception {
//Given
Expand Down

0 comments on commit 1412c5a

Please sign in to comment.