From cac3ad6a3abe1d6f3d2ad764c9605581db50b617 Mon Sep 17 00:00:00 2001 From: Farshid Tavakolizadeh Date: Mon, 25 Apr 2022 15:59:37 +0200 Subject: [PATCH] Add config tests for app-rfid-llrp-inventory --- .github/workflows/snap-testing.yml | 1 + .../app-rfid-llrp-inventory/config_test.go | 27 +++++++------------ .../app-rfid-llrp-inventory/main_test.go | 7 +++-- 3 files changed, 16 insertions(+), 19 deletions(-) diff --git a/.github/workflows/snap-testing.yml b/.github/workflows/snap-testing.yml index d525fe4..e2deadd 100644 --- a/.github/workflows/snap-testing.yml +++ b/.github/workflows/snap-testing.yml @@ -43,6 +43,7 @@ jobs: - name: device-rfid-llrp - name: app-rfid-llrp-inventory + channel: edge/pr-74 # use local action to test diff --git a/test/suites/app-rfid-llrp-inventory/config_test.go b/test/suites/app-rfid-llrp-inventory/config_test.go index 22cea81..121f92a 100644 --- a/test/suites/app-rfid-llrp-inventory/config_test.go +++ b/test/suites/app-rfid-llrp-inventory/config_test.go @@ -7,25 +7,18 @@ import ( // Deprecated func TestEnvConfig(t *testing.T) { + utils.SetEnvConfig(t, appRfidLlrpSnap, appRfidLlrpService, defaultServicePort) +} - t.Run("change service port", func(t *testing.T) { - t.Cleanup(func() { - utils.SnapStop(t, appRfidLlrpService) - utils.SnapUnset(t, appRfidLlrpSnap, "env.service.port") - }) - - const newPort = "56789" - - // make sure the port is available before using it - utils.RequirePortAvailable(t, newPort) +func TestAppConfig(t *testing.T) { + utils.SetAppConfig(t, appRfidLlrpSnap, appRfidLlrpService, appName, defaultServicePort) +} - utils.SnapStop(t, appRfidLlrpSnap) - utils.SnapSet(t, appRfidLlrpSnap, "env.service.port", newPort) - utils.SnapStart(t, appRfidLlrpSnap) - utils.WaitServiceOnline(t, 60, newPort) - }) +func TestGlobalConfig(t *testing.T) { + // start clean + utils.SetGlobalConfig(t, appRfidLlrpSnap, appRfidLlrpService, defaultServicePort) } -func TestAppConfig(t *testing.T) { - t.Skip("TODO") +func TestMixedConfig(t *testing.T) { + utils.SetMixedConfig(t, appRfidLlrpSnap, appRfidLlrpService, appName, defaultServicePort) } diff --git a/test/suites/app-rfid-llrp-inventory/main_test.go b/test/suites/app-rfid-llrp-inventory/main_test.go index 021bc03..841049e 100644 --- a/test/suites/app-rfid-llrp-inventory/main_test.go +++ b/test/suites/app-rfid-llrp-inventory/main_test.go @@ -8,8 +8,11 @@ import ( "time" ) -const appRfidLlrpSnap = "edgex-app-rfid-llrp-inventory" -const appRfidLlrpService = "edgex-app-rfid-llrp-inventory.app-rfid-llrp-inventory" +const ( + appRfidLlrpSnap = "edgex-app-rfid-llrp-inventory" + appName = "app-rfid-llrp-inventory" + appRfidLlrpService = appRfidLlrpSnap + "." + appName +) var start = time.Now()