diff options
Diffstat (limited to 'test/sdks_test.go')
-rw-r--r-- | test/sdks_test.go | 28 |
1 files changed, 19 insertions, 9 deletions
diff --git a/test/sdks_test.go b/test/sdks_test.go index 6319542..51f1d95 100644 --- a/test/sdks_test.go +++ b/test/sdks_test.go @@ -26,7 +26,6 @@ import ( "testing" "time" - "gerrit.automotivelinux.org/gerrit/src/xds/xds-agent/lib/xaapiv1" "gerrit.automotivelinux.org/gerrit/src/xds/xds-server/lib/xsapiv1" socketio_client "github.com/sebd71/go-socket.io-client" "github.com/stretchr/testify/assert" @@ -91,6 +90,8 @@ func NewIoSocketClient(url, clientID string) (*IOSockClient, error) { return sCli, err } + //sCli.Conn.On(xsapiv1.) + return sCli, nil } @@ -129,24 +130,33 @@ func TestSdks(t *testing.T) { } } -func TestInstallFakeSdk(t *testing.T) { - sdk := xaapiv1.SDKInstallArgs{ - ID: "", - Filename: sdkFileName, - Force: false, - } +func installFakeSdk(t *testing.T, sdkInstall xsapiv1.SDKInstallArgs) xsapiv1.SDK { var sdkRes xsapiv1.SDK - assert.Nil(t, HTTPCli.Post("/sdks", sdk, &sdkRes)) + assert.Nil(t, HTTPCli.Post("/sdks", sdkInstall, &sdkRes)) assert.Equal(t, sdkRes.Status, "Installing") /*waiting for SDKStateChange event from channel*/ sdkFromEvent := <-ch t.Log(sdkFromEvent) assert.Equal(t, sdkRes.ID, sdkFromEvent.ID) assert.Equal(t, "Installed", sdkFromEvent.Status) + return sdkFromEvent +} + +func TestInstallFakeSdk(t *testing.T) { + sdk := xsapiv1.SDKInstallArgs{ + ID: "", + Filename: sdkFileName, + Force: false, + } + installFakeSdk(t, sdk) + var sdkRes xsapiv1.SDK + assert.NotNil(t, HTTPCli.Post("/sdks", sdk, &sdkRes)) + sdk.Force = true + //installFakeSdk(t, sdk) } func TestSdksError(t *testing.T) { - sdk := xaapiv1.SDKInstallArgs{ + sdk := xsapiv1.SDKInstallArgs{ ID: "", Filename: "", Force: false, |