Skip to content
This repository has been archived by the owner on Oct 23, 2023. It is now read-only.

Commit

Permalink
Add config tests for device-rfid-llrp (#57)
Browse files Browse the repository at this point in the history
  • Loading branch information
farshidtz authored Apr 25, 2022
1 parent a481b76 commit 018ca2b
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 19 deletions.
27 changes: 10 additions & 17 deletions test/suites/device-rfid-llrp/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,25 +7,18 @@ import (

// Deprecated
func TestEnvConfig(t *testing.T) {
utils.SetEnvConfig(t, deviceRfidLlrpSnap, deviceRfidLlrpService, defaultServicePort)
}

t.Run("change service port", func(t *testing.T) {
t.Cleanup(func() {
utils.SnapStop(t, deviceRfidLlrpService)
utils.SnapUnset(t, deviceRfidLlrpSnap, "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, deviceRfidLlrpSnap, deviceRfidLlrpService, deviceRfidApp, defaultServicePort)
}

utils.SnapStop(t, deviceRfidLlrpSnap)
utils.SnapSet(t, deviceRfidLlrpSnap, "env.service.port", newPort)
utils.SnapStart(t, deviceRfidLlrpSnap)
utils.WaitServiceOnline(t, 60, newPort)
})
func TestGlobalConfig(t *testing.T) {
// start clean
utils.SetGlobalConfig(t, deviceRfidLlrpSnap, deviceRfidLlrpService, defaultServicePort)
}

func TestAppConfig(t *testing.T) {
t.Skip("TODO")
func TestMixedConfig(t *testing.T) {
utils.SetMixedConfig(t, deviceRfidLlrpSnap, deviceRfidLlrpService, deviceRfidApp, defaultServicePort)
}
7 changes: 5 additions & 2 deletions test/suites/device-rfid-llrp/main_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,11 @@ import (
"time"
)

const deviceRfidLlrpSnap = "edgex-device-rfid-llrp"
const deviceRfidLlrpService = "edgex-device-rfid-llrp.device-rfid-llrp"
const (
deviceRfidLlrpSnap = "edgex-device-rfid-llrp"
deviceRfidApp = "device-rfid-llrp"
deviceRfidLlrpService = "edgex-device-rfid-llrp." + deviceRfidApp
)

var start = time.Now()

Expand Down

0 comments on commit 018ca2b

Please sign in to comment.