Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

m1 build fixes #7720

Merged
merged 1 commit into from
Nov 8, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
import static org.junit.jupiter.api.Assertions.assertTrue;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.never;
import static org.mockito.Mockito.spy;
import static org.mockito.Mockito.times;
import static org.mockito.Mockito.verify;

Expand All @@ -18,6 +17,7 @@
import io.airbyte.commons.concurrency.VoidCallable;
import java.util.Iterator;
import java.util.List;
import java.util.concurrent.atomic.AtomicBoolean;
import java.util.stream.Stream;
import org.junit.jupiter.api.Test;

Expand All @@ -38,15 +38,18 @@ void testFromIterator() throws Exception {

@Test
void testFromStream() throws Exception {
final Stream<String> stream = spy(Stream.of("a", "b", "c"));
final AtomicBoolean isClosed = new AtomicBoolean(false);
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can't spy a Stream when iterator() is called because it is a public final method in Java 17.

This checks the same thing, but in a more future-compatible way.

final Stream<String> stream = Stream.of("a", "b", "c");
stream.onClose(() -> isClosed.set(true));

final AutoCloseableIterator<String> iterator = AutoCloseableIterators.fromStream(stream);

assertNext(iterator, "a");
assertNext(iterator, "b");
assertNext(iterator, "c");
iterator.close();

verify(stream).close();
assertTrue(isClosed.get());
}

private void assertNext(final Iterator<String> iterator, final String value) {
Expand Down
2 changes: 1 addition & 1 deletion docker-compose.build-m1.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ services:
build:
dockerfile: Dockerfile
args:
ARCH: ${DOCKER_BUILD_ARCH}
DOCKER_BUILD_ARCH: ${DOCKER_BUILD_ARCH}
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This didn't align with the env variables declared.

JDK_VERSION: ${JDK_VERSION}
context: airbyte-workers
labels:
Expand Down