Implement Boot with test 00/177400/2
authorAleksander Mistewicz <a.mistewicz@samsung.com>
Wed, 29 Nov 2017 17:29:02 +0000 (18:29 +0100)
committerAleksander Mistewicz <a.mistewicz@samsung.com>
Thu, 28 Jun 2018 14:50:17 +0000 (16:50 +0200)
Change-Id: I059792863037d06331fd624ba71543aedd7101ad
Signed-off-by: Aleksander Mistewicz <a.mistewicz@samsung.com>
manager/dryad_job_runner.go
manager/dryad_job_runner_test.go

index 36c50e1..d2889ae 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 f984ae7..1681ed7 100644 (file)
@@ -22,6 +22,7 @@ import (
        "context"
 
        "git.tizen.org/tools/weles"
+       "git.tizen.org/tools/weles/manager/dryad"
 
        "github.com/golang/mock/gomock"
        . "github.com/onsi/ginkgo"
@@ -58,5 +59,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())
        })
 })