package test import ( aa "goagent/actuator" "os" "testing" ) func init() { _=os.Setenv("grpc_server","127.0.0.1:50051") } func TestGetSlotList(t *testing.T){ var want=[] struct{ id int32 host string text string }{ {1,"host-1","docker run -d python:3.8"},{3,"host-1","docker run -d python:3.8"}, } commandList, err := aa.GetRunnableSlotList() if err!=nil{ t.Error(err) } if len(commandList)!=len(want){ t.Error("not what we want") } for i,j:=range commandList{ if j.Id!=want[i].id || j.Host!=want[i].host ||j.CommandText!=want[i].text{ t.Error("wrong value") } } }