refWorkerList[2], refWorkerList[3], refWorkerList[5]})
})
})
+
+ Describe("GetWorkerInfo", func() {
+ It("should fail to GetWorkerInfo of nonexistent worker", func() {
+ uuid := randomUUID()
+ _, err := wl.GetWorkerInfo(uuid)
+ Expect(err).To(Equal(ErrWorkerNotFound))
+ })
+
+ It("should work to GetWorkerInfo", func() {
+ workerInfo, err := wl.GetWorkerInfo(worker)
+ Expect(err).ToNot(HaveOccurred())
+ Expect(workerInfo).To(Equal(*wl.workers[worker]))
+ })
+ })
})
})
// GetWorkerInfo is an implementation of GetWorkerInfo from Workers interface.
func (wl *WorkerList) GetWorkerInfo(uuid WorkerUUID) (WorkerInfo, error) {
- return WorkerInfo{}, ErrNotImplemented
+ worker, ok := wl.workers[uuid]
+ if !ok {
+ return WorkerInfo{}, ErrWorkerNotFound
+ }
+ return *worker, nil
}
+++ /dev/null
-/*
- * Copyright (c) 2017 Samsung Electronics Co., Ltd All Rights Reserved
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License
- */
-
-package workers_test
-
-import (
- . "git.tizen.org/tools/boruta"
- . "git.tizen.org/tools/boruta/workers"
-
- . "github.com/onsi/ginkgo"
- . "github.com/onsi/gomega"
-)
-
-var _ = Describe("WorkerList", func() {
- var wl *WorkerList
- BeforeEach(func() {
- wl = NewWorkerList()
- })
-
- It("should return ErrNotImplemented", func() {
- var (
- err error
- uuid WorkerUUID = ""
- )
-
- By("GetWorkerInfo")
- _, err = wl.GetWorkerInfo(uuid)
- Expect(err).To(Equal(ErrNotImplemented))
- })
-})