Implement Boot with test 74/162374/1
authorAleksander Mistewicz <a.mistewicz@samsung.com>
Wed, 29 Nov 2017 17:29:02 +0000 (18:29 +0100)
committerAleksander Mistewicz <a.mistewicz@samsung.com>
Thu, 30 Nov 2017 13:25:57 +0000 (14:25 +0100)
Change-Id: I059792863037d06331fd624ba71543aedd7101ad
Signed-off-by: Aleksander Mistewicz <a.mistewicz@samsung.com>
manager/dryad_job_runner.go
manager/dryad_job_runner_test.go

index f44bf12..66875f4 100644 (file)
@@ -79,9 +79,22 @@ func (d *dryadJobRunner) Deploy() (err error) {
 }
 
 // Boot is part of DryadJobRunner interface.
-func (d *dryadJobRunner) Boot() error {
-       // TODO(amistewicz): implement.
-       return d.rusalka.DUT()
+func (d *dryadJobRunner) Boot() (err error) {
+       // Attempt to start a device boot.
+       err = d.rusalka.DUT()
+       if err != nil {
+               return
+       }
+       err = d.rusalka.PowerTick()
+       if err != nil {
+               return
+       }
+
+       // Login to the device only if credentials were specified.
+       if username, password := d.conf.Action.Boot.Login, d.conf.Action.Boot.Password; username != "" && password != "" {
+               return d.device.Login(dryad.Credentials{username, password})
+       }
+       return nil
 }
 
 // Test is part of DryadJobRunner interface.
index 5525b6b..15208e1 100644 (file)
@@ -20,6 +20,7 @@ import (
        "context"
 
        "git.tizen.org/tools/weles"
+       "git.tizen.org/tools/weles/manager/dryad"
 
        "github.com/golang/mock/gomock"
        . "github.com/onsi/ginkgo"
@@ -56,5 +57,14 @@ var _ = Describe("DryadJobRunner", func() {
                )
 
                Expect(djr.Deploy()).To(Succeed())
+
+               By("Boot")
+               gomock.InOrder(
+                       mockSession.EXPECT().DUT(),
+                       mockSession.EXPECT().PowerTick(),
+                       mockDevice.EXPECT().Login(dryad.Credentials{basicConfig.Action.Boot.Login, basicConfig.Action.Boot.Password}),
+               )
+
+               Expect(djr.Boot()).To(Succeed())
        })
 })