diff --git a/.mochapodrc.yml b/.mochapodrc.yml index a6671536..d7cb9f72 100644 --- a/.mochapodrc.yml +++ b/.mochapodrc.yml @@ -7,14 +7,15 @@ testfs: # in the `testfs` configuration. filesystem: /mnt/boot: - os-release: - from: test/data/etc/os-release config.json: from: test/data/testconfig.json config.txt: from: test/data/mnt/boot/config.txt device-type.json: from: test/data/mnt/boot/device-type.json + /mnt/root/etc: + os-release: + from: test/data/etc/os-release # The `keep` list defines files that already exist in the # filesystem and need to be backed up before setting up the test environment keep: [] diff --git a/docker-compose.test.yml b/docker-compose.test.yml index 559090e3..cfd97229 100644 --- a/docker-compose.test.yml +++ b/docker-compose.test.yml @@ -81,7 +81,7 @@ services: # Required to set mountpoints normally set in entry.sh ROOT_MOUNTPOINT: /mnt/root BOOT_MOUNTPOINT: /mnt/boot - HOST_OS_VERSION_PATH: /mnt/boot/os-release + HOST_OS_VERSION_PATH: /mnt/root/etc/os-release STATE_MOUNTPOINT: /mnt/state DATA_MOUNTPOINT: /mnt/data DATABASE_PATH: /data/database.sqlite diff --git a/mount-partitions.sh b/mount-partitions.sh index eca44476..a17d8250 100755 --- a/mount-partitions.sh +++ b/mount-partitions.sh @@ -103,7 +103,11 @@ setup_then_mount "boot" "${BOOT_MOUNTPOINT}" export BOOT_MOUNTPOINT # Read from the os-release of boot partition instead of overlay -export HOST_OS_VERSION_PATH="${BOOT_MOUNTPOINT}/os-release" +# +# TODO: We need to remove the dependence on /mnt/root for this particular file. +# Reading from /mnt/boot/os-release is not always accurate, so we need to work +# with the OS team to find a better way to get the OS version. +export HOST_OS_VERSION_PATH="/mnt/root/etc/os-release" # CONFIG_MOUNT_POINT is set to /boot/config.json in Dockerfile.template, # but that's a legacy mount provided by host and we should override it. diff --git a/test/data/root/etc/os-release b/test/data/root/etc/os-release new file mode 100644 index 00000000..eb8f641e --- /dev/null +++ b/test/data/root/etc/os-release @@ -0,0 +1,11 @@ +ID="balena-os" +NAME="balenaOS" +VERSION="4.0.11+rev1" +VERSION_ID="4.0.11+rev1" +PRETTY_NAME="balenaOS 4.0.11+rev1" +DISTRO_CODENAME="kirkstone" +MACHINE="genericx86-64" +META_BALENA_VERSION="4.0.11" +BALENA_BOARD_REV="9c804eb" +META_BALENA_REV="2afff0f8" +SLUG="intel-nuc" \ No newline at end of file diff --git a/test/integration/device-api/actions.spec.ts b/test/integration/device-api/actions.spec.ts index 13ec6c20..a5316896 100644 --- a/test/integration/device-api/actions.spec.ts +++ b/test/integration/device-api/actions.spec.ts @@ -425,7 +425,7 @@ describe('manages application lifecycle', () => { // Versions match semver versioning scheme: major.minor.patch(+rev)? expect(body) .to.have.property('os_version') - .that.matches(/balenaOS\s[1-2]\.[0-9]{1,3}\.[0-9]{1,3}(?:\+rev[0-9])?/); + .that.matches(/balenaOS\s[1-4]\.[0-9]{1,3}\.[0-9]{1,3}(?:\+rev[0-9])?/); expect(body) .to.have.property('supervisor_version') .that.matches(/(?:[0-9]+\.?){3}/);