From 5bff32466f45e3992293195f3e99882e32fb16bc Mon Sep 17 00:00:00 2001 From: Jaime Date: Fri, 29 Nov 2024 13:36:20 +0100 Subject: [PATCH] F-93: Packer script rm source code and go test case Signed-off-by: Jaime --- .../plugins/onelease/plugin_test.go | 25 ++++--------------- packer/service_VRouter/VRouter.pkr.hcl | 7 ++++-- 2 files changed, 10 insertions(+), 22 deletions(-) diff --git a/appliances/VRouter/DHCP4v2/coredhcp-onelease/plugins/onelease/plugin_test.go b/appliances/VRouter/DHCP4v2/coredhcp-onelease/plugins/onelease/plugin_test.go index 6de24c2e..4822cc3b 100644 --- a/appliances/VRouter/DHCP4v2/coredhcp-onelease/plugins/onelease/plugin_test.go +++ b/appliances/VRouter/DHCP4v2/coredhcp-onelease/plugins/onelease/plugin_test.go @@ -380,11 +380,11 @@ func TestSetupRange(t *testing.T) { { name: "Extend expired IP lease with no MAC2IP (192.168.1.5)", args: []string{ - "test_leases.db", // filename - "192.168.1.1", // start IP - "192.168.1.7", // end IP - "60s", // lease time - "--excluded-ips", "192.168.1.3,192.168.1.4", // excluded IPs + "test_leases.db", // filename + "192.168.1.1", // start IP + "192.168.1.7", // end IP + "60s", // lease time + "--excluded-ips", "192.168.1.255", // try to exclude out of range IP }, expectedLeaseTime: 60 * time.Second, reqMACAddr: net.HardwareAddr{0x02, 0x00, 0xc0, 0xa8, 0x01, 0x27}, @@ -392,21 +392,6 @@ func TestSetupRange(t *testing.T) { expectSetUpError: false, expectHandlerError: false, }, - // { - // name: "New MAC get expired IP lease with no MAC2IP (192.168.1.7)", - // args: []string{ - // "test_leases.db", // filename - // "192.168.1.1", // start IP - // "192.168.1.7", // end IP - // "60s", // lease time - // "--excluded-ips", "192.168.1.3,192.168.1.4", // excluded IPs - // }, - // expectedLeaseTime: 60 * time.Second, - // reqMACAddr: net.HardwareAddr{0x54, 0x01, 0xc0, 0xa8, 0x11, 0x09}, - // expectedIP: net.ParseIP("192.168.1.7"), - // expectSetUpError: false, - // expectHandlerError: false, - // }, { name: "Invalid Number of Arguments", args: []string{ diff --git a/packer/service_VRouter/VRouter.pkr.hcl b/packer/service_VRouter/VRouter.pkr.hcl index c35c775c..010b8979 100644 --- a/packer/service_VRouter/VRouter.pkr.hcl +++ b/packer/service_VRouter/VRouter.pkr.hcl @@ -98,9 +98,12 @@ build { } provisioner "shell" { inline_shebang = "/bin/bash -e" + environment_vars = [ + "COREDHCP_ONELEASE_DIR=/etc/one-appliance/service.d/VRouter/DHCP4v2/coredhcp-onelease", + ] inline = [ - "cd /etc/one-appliance/service.d/VRouter/DHCP4v2/coredhcp-onelease", - "CGO_ENABLED=1 GCC=musl-gcc go build", + "CGO_ENABLED=1 GCC=musl-gcc go build -C $COREDHCP_ONELEASE_DIR", + "find $COREDHCP_ONELEASE_DIR \\( -type f ! -name 'coredhcp-onelease' -o -type d -empty \\) -delete", ] } provisioner "shell" {