From da589f25a08f3d117c58d7765f3982a72693f61a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Roth?= Date: Tue, 3 Dec 2024 20:05:45 +0800 Subject: [PATCH] fix unit tests on arm and fix etcd data dir --- Makefile | 4 ++-- files/package_pool_test.go | 6 +++--- system/lib.py | 4 ++-- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/Makefile b/Makefile index 3635a0e97..3661948bb 100644 --- a/Makefile +++ b/Makefile @@ -86,12 +86,12 @@ install: test: prepare swagger etcd-install ## Run unit tests @echo "\e[33m\e[1mStarting etcd ...\e[0m" - @mkdir -p /tmp/etcd-data; system/t13_etcd/start-etcd.sh > /tmp/etcd-data/etcd.log 2>&1 & + @mkdir -p /tmp/aptly-etcd-data; system/t13_etcd/start-etcd.sh > /tmp/aptly-etcd-data/etcd.log 2>&1 & @echo "\e[33m\e[1mRunning go test ...\e[0m" go test -v ./... -gocheck.v=true -coverprofile=unit.out; echo $$? > .unit-test.ret @echo "\e[33m\e[1mStopping etcd ...\e[0m" @pid=`cat /tmp/etcd.pid`; kill $$pid - @rm -f /tmp/etcd-data/etcd.log + @rm -f /tmp/aptly-etcd-data/etcd.log @ret=`cat .unit-test.ret`; if [ "$$ret" = "0" ]; then echo "\n\e[32m\e[1mUnit Tests SUCCESSFUL\e[0m"; else echo "\n\e[31m\e[1mUnit Tests FAILED\e[0m"; fi; rm -f .unit-test.ret; exit $$ret system-test: prepare swagger etcd-install ## Run system tests diff --git a/files/package_pool_test.go b/files/package_pool_test.go index f06d6bcfd..4cd9476b9 100644 --- a/files/package_pool_test.go +++ b/files/package_pool_test.go @@ -120,7 +120,7 @@ func (s *PackagePoolSuite) TestImportOk(c *C) { if isSameDevice(s) { c.Check(info.Sys().(*syscall.Stat_t).Nlink > 1, Equals, true) } else { - c.Check(info.Sys().(*syscall.Stat_t).Nlink, Equals, uint64(1)) + c.Check(info.Sys().(*syscall.Stat_t).Nlink == 1, Equals, true) } // import as different name @@ -359,7 +359,7 @@ func (s *PackagePoolSuite) TestLink(c *C) { if isSameDevice(s) { c.Check(info.Sys().(*syscall.Stat_t).Nlink > 2, Equals, true) } else { - c.Check(info.Sys().(*syscall.Stat_t).Nlink, Equals, uint64(2)) + c.Check(info.Sys().(*syscall.Stat_t).Nlink == 2, Equals, true) } } @@ -377,7 +377,7 @@ func (s *PackagePoolSuite) TestSymlink(c *C) { if isSameDevice(s) { c.Check(info.Sys().(*syscall.Stat_t).Nlink > 2, Equals, true) } else { - c.Check(info.Sys().(*syscall.Stat_t).Nlink, Equals, uint64(1)) + c.Check(info.Sys().(*syscall.Stat_t).Nlink == 1, Equals, true) } info, err = os.Lstat(dstPath) diff --git a/system/lib.py b/system/lib.py index caba606c4..1287f81d5 100644 --- a/system/lib.py +++ b/system/lib.py @@ -253,8 +253,8 @@ def prepare_fixture(self): self.shutdown_etcd() # remove existing database - if os.path.exists("/tmp/etcd-data"): - shutil.rmtree("/tmp/etcd-data") + if os.path.exists("/tmp/aptly-etcd-data"): + shutil.rmtree("/tmp/aptly-etcd-data") if self.fixtureDB: print("import etcd")