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

Fix libcnb-tests's integration tests with newer Rosetta/Docker Desktop #707

Merged
merged 1 commit into from
Oct 31, 2023

Conversation

edmorley
Copy link
Member

@edmorley edmorley commented Oct 31, 2023

libcnb-test's own integration tests were failing locally when run using newer versions of Docker Desktop and/or the Rosetta feature in macOS 14.1.

Rosetta now creates a $HOME/.cache/rosetta directory that was breaking the directory listing assertions in the app_dir_preprocessor test:

---- app_dir_preprocessor stdout ----
thread 'app_dir_preprocessor' panicked at libcnb-test/tests/integration_test.rs:189:13:
assertion `left == right` failed
  left: ".\n./.cache\n./.cache/rosetta\n./Procfile\n./subdir1\n./subdir1/file2.txt\n./subdir1/subdir2\n./subdir1/subdir2/subdir3\n./subdir1/subdir2/subdir3/file3.txt\n"
 right: ".\n./Procfile\n./subdir1\n./subdir1/file2.txt\n./subdir1/subdir2\n./subdir1/subdir2/subdir3\n./subdir1/subdir2/subdir3/file3.txt\n"

In addition, it seems the newer Docker daemon now no longer rejects port 0, which was the port used by the expose_port_invalid_port test. Previously the Docker daemon would return this error:

docker: Error response from daemon: driver failed programming external connectivity on endpoint libcnbtest_yjlrqgjxvpgr (e94262e0ff239906824e7dd76c4637db66de1948874b9e0a58b5ae1771ce66bb):  (iptables failed: iptables --wait -t nat -A DOCKER -p tcp -d 127.0.0.1 --dport 32779 -j DNAT --to-destination 172.17.0.2:0 ! -i docker0: iptables v1.8.7 (nf_tables): Port `0' not valid

Try `iptables -h' or 'iptables --help' for more information.
 (exit status 2)).

There isn't another bogus port we can use (since the data types use an unsigned 16 bit int, whose max value is the same as the max port allowed - so we can't use a port like 99999), and the test itself is somewhat redundant, since failing start_container() is already tested in other ways.

As such the expose_port_invalid_port test has been removed.

It's worth noting that neither of these failures were made worse by the switch from Bollard to the Docker CLI, since that only changed the Docker client, whereas both of these failures were due to a new version of the daemon (and/or VM components that Docker for Desktop uses to run the daemon) and Rosetta.

Fixes #706.
GUS-W-14395756.

libcnb-test's own integration tests were failing locally when run using
newer versions of Docker Desktop and/or the Rosetta feature in
macOS 14.1.

Rosetta now creates a `$HOME/.cache/rosetta` directory that was breaking
the directory listing assertions in the `app_dir_preprocessor` test:

```
---- app_dir_preprocessor stdout ----
thread 'app_dir_preprocessor' panicked at libcnb-test/tests/integration_test.rs:189:13:
assertion `left == right` failed
  left: ".\n./.cache\n./.cache/rosetta\n./Procfile\n./subdir1\n./subdir1/file2.txt\n./subdir1/subdir2\n./subdir1/subdir2/subdir3\n./subdir1/subdir2/subdir3/file3.txt\n"
 right: ".\n./Procfile\n./subdir1\n./subdir1/file2.txt\n./subdir1/subdir2\n./subdir1/subdir2/subdir3\n./subdir1/subdir2/subdir3/file3.txt\n"
```

In addition, it seems the newer Docker daemon now supports port 0,
which was the port used by the `expose_port_invalid_port` test. There
isn't another bogus port we can use (since the data types use an unsigned
16 bit int, whose max value is the same as the max port allowed - so we
can't use a port like 99999), and the test itself is somewhat redundant,
since failing `start_container()` is already tested in other ways.

As such the `expose_port_invalid_port` test has been removed.

Fixes #706.
GUS-W-14395756.
@edmorley edmorley self-assigned this Oct 31, 2023
@edmorley edmorley marked this pull request as ready for review October 31, 2023 12:24
@edmorley edmorley requested a review from a team as a code owner October 31, 2023 12:24
@edmorley edmorley enabled auto-merge (squash) October 31, 2023 12:36
@edmorley edmorley merged commit 2698a71 into main Oct 31, 2023
6 checks passed
@edmorley edmorley deleted the edmorley/fix-tests branch October 31, 2023 12:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

libcnb-tests: Integration tests failing on main when run locally on macOS
2 participants