Skip to content

Commit

Permalink
Update tests to make them runnable on M1 Mac
Browse files Browse the repository at this point in the history
  • Loading branch information
dmage committed Apr 17, 2024
1 parent 5306142 commit f4ded0d
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 2 deletions.
2 changes: 2 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ build-golang-executable:

build-online-zip:
$(CLIENT) build \
--arch amd64 \
-t mirror-registry-online:${RELEASE_VERSION} \
--build-arg RELEASE_VERSION=${RELEASE_VERSION} \
--build-arg QUAY_IMAGE=${QUAY_IMAGE} \
Expand All @@ -29,6 +30,7 @@ build-online-zip:

build-offline-zip:
$(CLIENT) build \
--arch amd64 \
-t mirror-registry-offline:${RELEASE_VERSION} \
--build-arg RELEASE_VERSION=${RELEASE_VERSION} \
--build-arg QUAY_IMAGE=${QUAY_IMAGE} \
Expand Down
11 changes: 10 additions & 1 deletion test/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,15 @@ VERSION := dev-$(TREEISH)
# from.
OLD_VERSION := 1.2.9

# VAGRANT_UP_ARGS allows to provide additional arguments to `vagrant up`.
# Example:
# make test-install VAGRANT_UP_ARGS='--provider=qemu'
ifeq ($(shell uname -s) $(shell uname -m),Darwin arm64)
VAGRANT_UP_ARGS := --provider=qemu
else
VAGRANT_UP_ARGS :=
endif

all: test-install test-sudo-install test-sudo-upgrade

# mirror-registry archive from the current repository.
Expand All @@ -36,7 +45,7 @@ $(MAKE) start-vagrant && (set -x; $(1)); ret=$$?; $(MAKE) stop-vagrant && exit $
endef

start-vagrant:
vagrant up
vagrant up $(VAGRANT_UP_ARGS)

stop-vagrant:
ifneq ($(DEBUG), 1)
Expand Down
22 changes: 21 additions & 1 deletion test/Vagrantfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,33 @@
# vi: set ft=ruby :

Vagrant.configure("2") do |config|
config.vm.box = "generic/fedora37"
config.vm.box = "generic/fedora36"
config.vm.box_architecture = "amd64"
config.vm.network "forwarded_port", guest: 8080, host: 8080
config.vm.network "forwarded_port", guest: 8443, host: 8443
config.vm.provider "virtualbox" do |vb|
vb.memory = "3072"
end
config.vm.provider "qemu" do |qe|
qe.arch = "x86_64"
qe.machine = "q35"
qe.cpu = "max"
qe.smp = "cpus=4,sockets=1,cores=4,threads=1"
qe.memory = "3072"
qe.net_device = "virtio-net-pci"
qe.extra_qemu_args = %w(-accel tcg,thread=multi,tb-size=512)
qe.forward_port("guestssh", 22, 50021, auto: true)
end
config.vm.provision "shell", inline: <<-SHELL
set -x
# On macOS with qemu, the systemd-resolved does not work properly. To work
# around this issue, we disable the systemd-resolved and use Google's DNS.
systemctl stop systemd-resolved
systemctl disable systemd-resolved
rm -f /etc/resolv.conf
echo "nameserver 8.8.8.8" >/etc/resolv.conf
dnf install -y \
acl \
openssl \
Expand Down

0 comments on commit f4ded0d

Please sign in to comment.