@@ -10,6 +10,7 @@ import (
1010 "testing"
1111 "time"
1212
13+ "github.com/mostlygeek/llama-swap/config"
1314 "github.com/stretchr/testify/assert"
1415)
1516
@@ -90,7 +91,7 @@ func TestProcess_WaitOnMultipleStarts(t *testing.T) {
9091// test that the automatic start returns the expected error type
9192func TestProcess_BrokenModelConfig (t * testing.T ) {
9293 // Create a process configuration
93- config := ModelConfig {
94+ config := config. ModelConfig {
9495 Cmd : "nonexistent-command" ,
9596 Proxy : "http://127.0.0.1:9913" ,
9697 CheckEndpoint : "/health" ,
@@ -325,7 +326,7 @@ func TestProcess_ExitInterruptsHealthCheck(t *testing.T) {
325326
326327 // should run and exit but interrupt the long checkHealthTimeout
327328 checkHealthTimeout := 5
328- config := ModelConfig {
329+ config := config. ModelConfig {
329330 Cmd : "sleep 1" ,
330331 Proxy : "http://127.0.0.1:9913" ,
331332 CheckEndpoint : "/health" ,
@@ -402,15 +403,15 @@ func TestProcess_ForceStopWithKill(t *testing.T) {
402403 binaryPath := getSimpleResponderPath ()
403404 port := getTestPort ()
404405
405- config := ModelConfig {
406+ conf := config. ModelConfig {
406407 // note --ignore-sig-term which ignores the SIGTERM signal so a SIGKILL must be sent
407408 // to force the process to exit
408409 Cmd : fmt .Sprintf ("%s --port %d --respond %s --silent --ignore-sig-term" , binaryPath , port , expectedMessage ),
409410 Proxy : fmt .Sprintf ("http://127.0.0.1:%d" , port ),
410411 CheckEndpoint : "/health" ,
411412 }
412413
413- process := NewProcess ("stop_immediate" , 2 , config , debugLogger , debugLogger )
414+ process := NewProcess ("stop_immediate" , 2 , conf , debugLogger , debugLogger )
414415 defer process .Stop ()
415416
416417 // reduce to make testing go faster
@@ -450,15 +451,15 @@ func TestProcess_ForceStopWithKill(t *testing.T) {
450451}
451452
452453func TestProcess_StopCmd (t * testing.T ) {
453- config := getTestSimpleResponderConfig ("test_stop_cmd" )
454+ conf := getTestSimpleResponderConfig ("test_stop_cmd" )
454455
455456 if runtime .GOOS == "windows" {
456- config .CmdStop = "taskkill /f /t /pid ${PID}"
457+ conf .CmdStop = "taskkill /f /t /pid ${PID}"
457458 } else {
458- config .CmdStop = "kill -TERM ${PID}"
459+ conf .CmdStop = "kill -TERM ${PID}"
459460 }
460461
461- process := NewProcess ("testStopCmd" , 2 , config , debugLogger , debugLogger )
462+ process := NewProcess ("testStopCmd" , 2 , conf , debugLogger , debugLogger )
462463 defer process .Stop ()
463464
464465 err := process .start ()
@@ -470,15 +471,15 @@ func TestProcess_StopCmd(t *testing.T) {
470471
471472func TestProcess_EnvironmentSetCorrectly (t * testing.T ) {
472473 expectedMessage := "test_env_not_emptied"
473- config := getTestSimpleResponderConfig (expectedMessage )
474+ conf := getTestSimpleResponderConfig (expectedMessage )
474475
475476 // ensure that the the default config does not blank out the inherited environment
476- configWEnv := config
477+ configWEnv := conf
477478
478479 // ensure the additiona variables are appended to the process' environment
479480 configWEnv .Env = append (configWEnv .Env , "TEST_ENV1=1" , "TEST_ENV2=2" )
480481
481- process1 := NewProcess ("env_test" , 2 , config , debugLogger , debugLogger )
482+ process1 := NewProcess ("env_test" , 2 , conf , debugLogger , debugLogger )
482483 process2 := NewProcess ("env_test" , 2 , configWEnv , debugLogger , debugLogger )
483484
484485 process1 .start ()
0 commit comments