Add depot, attendant, jetfire, optimus, ota services with kustomize overlays

This commit is contained in:
Chris Rai
2026-01-31 15:35:07 -05:00
parent a0ec642ca1
commit 9a5cb2f547
404 changed files with 38817 additions and 16 deletions

View File

@@ -0,0 +1,39 @@
package tests
import (
"fmt"
"github.com/fiskerinc/cloud-services/services/jetfire/handlers"
"github.com/fiskerinc/cloud-services/services/jetfire/services"
"github.com/fiskerinc/cloud-services/services/jetfire/utils"
"testing"
"github.com/fiskerinc/cloud-services/pkg/grpc/kafka_grpc"
"github.com/stretchr/testify/assert"
)
func TestHandleSignalMessage(t *testing.T) {
cache := services.GetVehicleCache()
ptrArray := make([]*kafka_grpc.GRPC_CANSignal, len(testCanSignalBatch))
for i := range testCanSignalBatch {
ptrArray[i] = &testCanSignalBatch[i]
}
services.ResetCacheVars()
cache = services.GetVehicleCache()
cache.Clear()
handlers.HandleSignalBatch(ptrArray, cache, nil)
assert.Equal(t, len(cache.Cache), 1)
// testing large timestamp gap; trigger new trip
state := cache.Cache[testVIN]
tripStartTime := utils.FloatToTime(1511.0)
assert.WithinDuration(t, state.TripStart, tripStartTime, 1e8)
assert.Equal(t, state.TripID, fmt.Sprintf("%s_%d", testVIN, 1511))
assert.WithinDuration(t, state.Timestamp, utils.FloatToTime(1512.0), 1e8)
assert.Equal(t, state.StateValues["BMS_PwrBattRmngCpSOC"], 45.0)
assert.Equal(t, state.StateValues["ESP_VehSpd"], 11.0)
}