X-Git-Url: https://ruderich.org/simon/gitweb/?a=blobdiff_plain;f=cmd%2Fsafcm%2Fsync_test.go;fp=cmd%2Fsafcm%2Fsync_test.go;h=4744ad553cd45715bcb08313842ad2700d5af800;hb=c899e17495d4eb932e0b4f428ec91882d845f1bc;hp=80b1589072ace73792c3bd51723b02320d996c61;hpb=9269fa3c94e700afc0be823f58ea473a2db8f3dc;p=safcm%2Fsafcm.git diff --git a/cmd/safcm/sync_test.go b/cmd/safcm/sync_test.go index 80b1589..4744ad5 100644 --- a/cmd/safcm/sync_test.go +++ b/cmd/safcm/sync_test.go @@ -24,6 +24,7 @@ import ( "ruderich.org/simon/safcm" "ruderich.org/simon/safcm/cmd/safcm/config" + "ruderich.org/simon/safcm/frontend" "ruderich.org/simon/safcm/rpc" "ruderich.org/simon/safcm/testutil" ) @@ -202,7 +203,7 @@ func TestLogEvent(t *testing.T) { tests := []struct { name string - event Event + event frontend.Event level safcm.LogLevel isTTY bool exp string @@ -211,7 +212,7 @@ func TestLogEvent(t *testing.T) { { "Error", - Event{ + frontend.Event{ Error: fmt.Errorf("fake error"), }, safcm.LogDebug3, @@ -221,7 +222,7 @@ func TestLogEvent(t *testing.T) { }, { "Error (tty)", - Event{ + frontend.Event{ Error: fmt.Errorf("fake error"), }, safcm.LogDebug3, @@ -231,7 +232,7 @@ func TestLogEvent(t *testing.T) { }, { "Error: escape", - Event{ + frontend.Event{ Error: fmt.Errorf("\x00"), }, safcm.LogDebug3, @@ -241,7 +242,7 @@ func TestLogEvent(t *testing.T) { }, { "Error: escape (tty)", - Event{ + frontend.Event{ Error: fmt.Errorf("\x00"), }, safcm.LogDebug3, @@ -252,8 +253,8 @@ func TestLogEvent(t *testing.T) { { "Log: info", - Event{ - Log: Log{ + frontend.Event{ + Log: frontend.Log{ Level: safcm.LogInfo, Text: "info log", }, @@ -265,8 +266,8 @@ func TestLogEvent(t *testing.T) { }, { "Log: info (tty)", - Event{ - Log: Log{ + frontend.Event{ + Log: frontend.Log{ Level: safcm.LogInfo, Text: "info log", }, @@ -278,8 +279,8 @@ func TestLogEvent(t *testing.T) { }, { "Log: verbose", - Event{ - Log: Log{ + frontend.Event{ + Log: frontend.Log{ Level: safcm.LogVerbose, Text: "verbose log", }, @@ -291,8 +292,8 @@ func TestLogEvent(t *testing.T) { }, { "Log: debug", - Event{ - Log: Log{ + frontend.Event{ + Log: frontend.Log{ Level: safcm.LogDebug, Text: "debug log", }, @@ -304,8 +305,8 @@ func TestLogEvent(t *testing.T) { }, { "Log: debug2", - Event{ - Log: Log{ + frontend.Event{ + Log: frontend.Log{ Level: safcm.LogDebug2, Text: "debug2 log", }, @@ -317,8 +318,8 @@ func TestLogEvent(t *testing.T) { }, { "Log: debug3", - Event{ - Log: Log{ + frontend.Event{ + Log: frontend.Log{ Level: safcm.LogDebug3, Text: "debug3 log", }, @@ -331,8 +332,8 @@ func TestLogEvent(t *testing.T) { }, { "Log: debug3 (tty)", - Event{ - Log: Log{ + frontend.Event{ + Log: frontend.Log{ Level: safcm.LogDebug3, Text: "debug3 log", }, @@ -345,8 +346,8 @@ func TestLogEvent(t *testing.T) { }, { "Log: escape", - Event{ - Log: Log{ + frontend.Event{ + Log: frontend.Log{ Level: safcm.LogInfo, Text: "\x00", }, @@ -358,8 +359,8 @@ func TestLogEvent(t *testing.T) { }, { "Log: escape (tty)", - Event{ - Log: Log{ + frontend.Event{ + Log: frontend.Log{ Level: safcm.LogInfo, Text: "\x00", }, @@ -372,7 +373,7 @@ func TestLogEvent(t *testing.T) { { "ConnEvent: stderr", - Event{ + frontend.Event{ ConnEvent: rpc.ConnEvent{ Type: rpc.ConnEventStderr, Data: "fake stderr", @@ -385,7 +386,7 @@ func TestLogEvent(t *testing.T) { }, { "ConnEvent: stderr (tty)", - Event{ + frontend.Event{ ConnEvent: rpc.ConnEvent{ Type: rpc.ConnEventStderr, Data: "fake stderr", @@ -398,7 +399,7 @@ func TestLogEvent(t *testing.T) { }, { "ConnEvent: debug", - Event{ + frontend.Event{ ConnEvent: rpc.ConnEvent{ Type: rpc.ConnEventDebug, Data: "conn debug", @@ -411,7 +412,7 @@ func TestLogEvent(t *testing.T) { }, { "ConnEvent: upload", - Event{ + frontend.Event{ ConnEvent: rpc.ConnEvent{ Type: rpc.ConnEventUpload, }, @@ -423,7 +424,7 @@ func TestLogEvent(t *testing.T) { }, { "ConnEvent: upload (ignored)", - Event{ + frontend.Event{ ConnEvent: rpc.ConnEvent{ Type: rpc.ConnEventUpload, }, @@ -435,7 +436,7 @@ func TestLogEvent(t *testing.T) { }, { "ConnEvent: invalid", - Event{ + frontend.Event{ ConnEvent: rpc.ConnEvent{ Type: 42, Data: "invalid", @@ -448,7 +449,7 @@ func TestLogEvent(t *testing.T) { }, { "ConnEvent: invalid (tty)", - Event{ + frontend.Event{ ConnEvent: rpc.ConnEvent{ Type: 42, Data: "invalid", @@ -461,7 +462,7 @@ func TestLogEvent(t *testing.T) { }, { "ConnEvent: escape", - Event{ + frontend.Event{ ConnEvent: rpc.ConnEvent{ Type: rpc.ConnEventStderr, Data: "\x00", @@ -474,7 +475,7 @@ func TestLogEvent(t *testing.T) { }, { "ConnEvent: escape (tty)", - Event{ + frontend.Event{ ConnEvent: rpc.ConnEvent{ Type: rpc.ConnEventDebug, Data: "\x01", @@ -488,8 +489,8 @@ func TestLogEvent(t *testing.T) { { "Escaped", - Event{ - Log: Log{ + frontend.Event{ + Log: frontend.Log{ Level: safcm.LogInfo, Text: "\x00", }, @@ -502,8 +503,8 @@ func TestLogEvent(t *testing.T) { }, { "Escaped (tty)", - Event{ - Log: Log{ + frontend.Event{ + Log: frontend.Log{ Level: safcm.LogInfo, Text: "\x00", }, @@ -517,7 +518,7 @@ func TestLogEvent(t *testing.T) { { "empty (invalid)", - Event{}, + frontend.Event{}, safcm.LogDebug3, false, "[INVALID=0] [fake-host] \n", @@ -527,8 +528,10 @@ func TestLogEvent(t *testing.T) { for _, tc := range tests { t.Run(tc.name, func(t *testing.T) { - tc.event.Host = &config.Host{ - Name: "fake-host", + tc.event.Host = &Sync{ + host: &config.Host{ + Name: "fake-host", + }, } var buf bytes.Buffer