Skip to content

Commit f4ded0d

Browse files
committed
Update tests to make them runnable on M1 Mac
1 parent 5306142 commit f4ded0d

File tree

3 files changed

+33
-2
lines changed

3 files changed

+33
-2
lines changed

Makefile

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ build-golang-executable:
1313

1414
build-online-zip:
1515
$(CLIENT) build \
16+
--arch amd64 \
1617
-t mirror-registry-online:${RELEASE_VERSION} \
1718
--build-arg RELEASE_VERSION=${RELEASE_VERSION} \
1819
--build-arg QUAY_IMAGE=${QUAY_IMAGE} \
@@ -29,6 +30,7 @@ build-online-zip:
2930

3031
build-offline-zip:
3132
$(CLIENT) build \
33+
--arch amd64 \
3234
-t mirror-registry-offline:${RELEASE_VERSION} \
3335
--build-arg RELEASE_VERSION=${RELEASE_VERSION} \
3436
--build-arg QUAY_IMAGE=${QUAY_IMAGE} \

test/Makefile

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,15 @@ VERSION := dev-$(TREEISH)
1212
# from.
1313
OLD_VERSION := 1.2.9
1414

15+
# VAGRANT_UP_ARGS allows to provide additional arguments to `vagrant up`.
16+
# Example:
17+
# make test-install VAGRANT_UP_ARGS='--provider=qemu'
18+
ifeq ($(shell uname -s) $(shell uname -m),Darwin arm64)
19+
VAGRANT_UP_ARGS := --provider=qemu
20+
else
21+
VAGRANT_UP_ARGS :=
22+
endif
23+
1524
all: test-install test-sudo-install test-sudo-upgrade
1625

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

3847
start-vagrant:
39-
vagrant up
48+
vagrant up $(VAGRANT_UP_ARGS)
4049

4150
stop-vagrant:
4251
ifneq ($(DEBUG), 1)

test/Vagrantfile

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,33 @@
22
# vi: set ft=ruby :
33

44
Vagrant.configure("2") do |config|
5-
config.vm.box = "generic/fedora37"
5+
config.vm.box = "generic/fedora36"
6+
config.vm.box_architecture = "amd64"
67
config.vm.network "forwarded_port", guest: 8080, host: 8080
78
config.vm.network "forwarded_port", guest: 8443, host: 8443
89
config.vm.provider "virtualbox" do |vb|
910
vb.memory = "3072"
1011
end
12+
config.vm.provider "qemu" do |qe|
13+
qe.arch = "x86_64"
14+
qe.machine = "q35"
15+
qe.cpu = "max"
16+
qe.smp = "cpus=4,sockets=1,cores=4,threads=1"
17+
qe.memory = "3072"
18+
qe.net_device = "virtio-net-pci"
19+
qe.extra_qemu_args = %w(-accel tcg,thread=multi,tb-size=512)
20+
qe.forward_port("guestssh", 22, 50021, auto: true)
21+
end
1122
config.vm.provision "shell", inline: <<-SHELL
23+
set -x
24+
25+
# On macOS with qemu, the systemd-resolved does not work properly. To work
26+
# around this issue, we disable the systemd-resolved and use Google's DNS.
27+
systemctl stop systemd-resolved
28+
systemctl disable systemd-resolved
29+
rm -f /etc/resolv.conf
30+
echo "nameserver 8.8.8.8" >/etc/resolv.conf
31+
1232
dnf install -y \
1333
acl \
1434
openssl \

0 commit comments

Comments
 (0)