Addressed the review comment of "unknow var source error".
Signed-off-by: Chao Li <chaol@vmware.com>
This commit is contained in:
parent
8636b9f239
commit
34caec908a
|
@ -28,7 +28,7 @@ func (m NamedVariables) Get(varDef VariableDefinition) (interface{}, bool, error
|
|||
return vars.Get(VariableDefinition{Name: varName})
|
||||
}
|
||||
|
||||
return nil, false, nil
|
||||
return nil, false, fmt.Errorf("unknown var source: %s", sourceName)
|
||||
}
|
||||
|
||||
func (m NamedVariables) List() ([]VariableDefinition, error) {
|
||||
|
|
|
@ -18,7 +18,7 @@ var _ = Describe("NamedVariables", func() {
|
|||
Expect(err).ToNot(HaveOccurred())
|
||||
})
|
||||
|
||||
It("return no value and not found if var source name doesn's exist", func() {
|
||||
It("return no value, not found and an error if var source name doesn't exist", func() {
|
||||
vars1 := StaticVariables{"key1": "val"}
|
||||
vars2 := StaticVariables{"key2": "val"}
|
||||
vars := NamedVariables{"s1": vars1, "s2": vars2}
|
||||
|
@ -26,7 +26,8 @@ var _ = Describe("NamedVariables", func() {
|
|||
val, found, err := vars.Get(VariableDefinition{Name: "s3:key1"})
|
||||
Expect(val).To(BeNil())
|
||||
Expect(found).To(BeFalse())
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
Expect(err).To(HaveOccurred())
|
||||
Expect(err).To(Equal(errors.New("unknown var source: s3")))
|
||||
})
|
||||
|
||||
It("return no value and not found if var source name is not specified", func() {
|
||||
|
|
Loading…
Reference in New Issue