feat(AveragePosition/GetNTRIPMountPoint): change return type, update cmd average_position

This commit is contained in:
2025-06-12 14:43:41 +02:00
parent 2c5d1442fe
commit 1fcf748310
11 changed files with 148 additions and 187 deletions

View File

@ -237,31 +237,6 @@ var testCases = []operationTestCase{
t.Errorf("%+v", errors.WithStack(err))
return
}
},
},
{
Name: "AveragePosition",
Run: func(t *testing.T, ops protocol.Operations) {
ctx := context.Background()
if err := ops.Connect(ctx); err != nil {
t.Errorf("%+v", errors.WithStack(err))
return
}
defer func() {
if err := ops.Close(ctx); err != nil {
t.Errorf("%+v", errors.WithStack(err))
}
}()
taskmessage, err := ops.AveragePosition(ctx)
if err != nil {
t.Errorf("%+v", errors.WithStack(err))
return
}
t.Logf("Task Message : %s", taskmessage)
},
},
{
@ -356,7 +331,7 @@ var testCases = []operationTestCase{
},
},
{
Name: "GetNTRIPMountPoint",
Name: "AveragePosition",
Run: func(t *testing.T, ops protocol.Operations) {
ctx := context.Background()
@ -371,29 +346,35 @@ var testCases = []operationTestCase{
}
}()
if err := ops.GetNTRIPMountPoint(ctx); err != nil {
t.Errorf("%+v", errors.WithStack(err))
return
}
broadcastCtx, cancel := context.WithTimeout(ctx, 5*time.Second)
defer cancel()
messages, err := ops.On(broadcastCtx, "task_status")
taskmessage, err := ops.AveragePosition(ctx)
if err != nil {
t.Errorf("%+v", errors.WithStack(err))
return
}
t.Logf("Task Message : %+v", taskmessage)
},
},
{
Name: "GetNTRIPMountPoint",
Run: func(t *testing.T, ops protocol.Operations) {
ctx := context.Background()
count := 0
for m := range messages {
t.Logf("new message: %s", spew.Sdump(m))
count++
if err := ops.Connect(ctx); err != nil {
t.Errorf("%+v", errors.WithStack(err))
return
}
if e, g := 1, count; g < e {
t.Errorf("expected total messages > %d, got %d", e, g)
defer func() {
if err := ops.Close(ctx); err != nil {
t.Errorf("%+v", errors.WithStack(err))
}
}()
taskMsg, err := ops.GetNTRIPMountPoint(ctx)
if err != nil {
t.Errorf("%+v", errors.WithStack(err))
return
}
t.Logf("Message : %+v", taskMsg)
},
},
}