From d828aacd0fb31bfba3325bacc5593de80ac95f51 Mon Sep 17 00:00:00 2001 From: Natanael Rodriguez Ramos Date: Thu, 10 Apr 2025 17:07:48 +0100 Subject: [PATCH] Fixed SPN HUB using wrong instance --- spn/docks/module_test.go | 2 +- spn/instance.go | 15 +++++++++++++++ spn/testing/simple/entrypoint.sh | 2 +- 3 files changed, 17 insertions(+), 2 deletions(-) diff --git a/spn/docks/module_test.go b/spn/docks/module_test.go index 47e34b43..2f333b93 100644 --- a/spn/docks/module_test.go +++ b/spn/docks/module_test.go @@ -47,7 +47,7 @@ func (stub *testInstance) Stopping() bool { func (stub *testInstance) SetCmdLineOperation(f func() error) {} func runTest(m *testing.M) error { - _ = log.Start() + _ = log.Start("info", true, "") ds, err := config.InitializeUnitTestDataroot("test-docks") if err != nil { diff --git a/spn/instance.go b/spn/instance.go index e8fa1789..89878843 100644 --- a/spn/instance.go +++ b/spn/instance.go @@ -508,6 +508,21 @@ func (i *Instance) ExitCode() int { return int(i.exitCode.Load()) } +// ShouldRestartIsSet returns whether the service/instance should be restarted. +func (i *Instance) ShouldRestartIsSet() bool { + return i.ShouldRestart +} + +// CommandLineOperationIsSet returns whether the command line option is set. +func (i *Instance) CommandLineOperationIsSet() bool { + return i.CommandLineOperation != nil +} + +// CommandLineOperationExecute executes the set command line option. +func (i *Instance) CommandLineOperationExecute() error { + return i.CommandLineOperation() +} + // SPNGroup fakes interface conformance. // SPNGroup is only needed on SPN clients. func (i *Instance) SPNGroup() *mgr.ExtendedGroup { diff --git a/spn/testing/simple/entrypoint.sh b/spn/testing/simple/entrypoint.sh index 5fe516e0..95f0efb8 100755 --- a/spn/testing/simple/entrypoint.sh +++ b/spn/testing/simple/entrypoint.sh @@ -14,4 +14,4 @@ cat /opt/shared/config-template.json | sed "s/\$HUBNAME/$HUBNAME/g" > /opt/data/ BIN=$(ls /opt/ | grep hub) # Start Hub. -/opt/$BIN --data /opt/data --log trace --spn-map test --bootstrap-file /opt/shared/bootstrap.dsd --api-address 0.0.0.0:817 --devmode +/opt/$BIN --log trace --spn-map test --bootstrap-file /opt/shared/bootstrap.dsd --api-address 0.0.0.0:817 --devmode