Skip to content

Commit 23ccbc2

Browse files
authored
Add more tests to arm and base (#983)
continuation of [RSDK-325]
1 parent 71c7992 commit 23ccbc2

File tree

2 files changed

+40
-0
lines changed

2 files changed

+40
-0
lines changed

component/arm/arm_test.go

+20
Original file line numberDiff line numberDiff line change
@@ -260,6 +260,17 @@ func TestWrapWithReconfigurable(t *testing.T) {
260260
reconfArm2, err := arm.WrapWithReconfigurable(reconfArm1)
261261
test.That(t, err, test.ShouldBeNil)
262262
test.That(t, reconfArm2, test.ShouldEqual, reconfArm1)
263+
264+
var actualArm2 arm.LocalArm = &mockLocal{Name: testArmName}
265+
reconfArm3, err := arm.WrapWithReconfigurable(actualArm2)
266+
test.That(t, err, test.ShouldBeNil)
267+
268+
reconfArm4, err := arm.WrapWithReconfigurable(reconfArm3)
269+
test.That(t, err, test.ShouldBeNil)
270+
test.That(t, reconfArm4, test.ShouldResemble, reconfArm3)
271+
272+
_, ok := reconfArm4.(arm.LocalArm)
273+
test.That(t, ok, test.ShouldBeTrue)
263274
}
264275

265276
func TestReconfigurableArm(t *testing.T) {
@@ -304,6 +315,15 @@ func TestReconfigurableArm(t *testing.T) {
304315
err = reconfArm3.Reconfigure(context.Background(), reconfArm1)
305316
test.That(t, err, test.ShouldNotBeNil)
306317
test.That(t, err, test.ShouldBeError, rutils.NewUnexpectedTypeError(reconfArm3, reconfArm1))
318+
319+
actualArm4 := &mock{Name: testArmName2}
320+
reconfArm4, err := arm.WrapWithReconfigurable(actualArm4)
321+
test.That(t, err, test.ShouldBeNil)
322+
test.That(t, reconfArm4, test.ShouldNotBeNil)
323+
324+
err = reconfArm3.Reconfigure(context.Background(), reconfArm4)
325+
test.That(t, err, test.ShouldBeNil)
326+
test.That(t, reconfArm3, test.ShouldResemble, reconfArm4)
307327
}
308328

309329
func TestStop(t *testing.T) {

component/base/base_test.go

+20
Original file line numberDiff line numberDiff line change
@@ -196,6 +196,17 @@ func TestWrapWithReconfigurable(t *testing.T) {
196196
reconfBase2, err := base.WrapWithReconfigurable(reconfBase1)
197197
test.That(t, err, test.ShouldBeNil)
198198
test.That(t, reconfBase2, test.ShouldEqual, reconfBase1)
199+
200+
var actualBase2 base.LocalBase = &mockLocal{Name: testBaseName}
201+
reconfBase3, err := base.WrapWithReconfigurable(actualBase2)
202+
test.That(t, err, test.ShouldBeNil)
203+
204+
reconfBase4, err := base.WrapWithReconfigurable(reconfBase3)
205+
test.That(t, err, test.ShouldBeNil)
206+
test.That(t, reconfBase4, test.ShouldResemble, reconfBase3)
207+
208+
_, ok := reconfBase4.(base.LocalBase)
209+
test.That(t, ok, test.ShouldBeTrue)
199210
}
200211

201212
func TestReconfigurableBase(t *testing.T) {
@@ -237,6 +248,15 @@ func TestReconfigurableBase(t *testing.T) {
237248
err = reconfBase3.Reconfigure(context.Background(), reconfBase1)
238249
test.That(t, err, test.ShouldNotBeNil)
239250
test.That(t, err, test.ShouldBeError, rutils.NewUnexpectedTypeError(reconfBase3, reconfBase1))
251+
252+
actualBase4 := &mock{Name: testBaseName2}
253+
reconfBase4, err := base.WrapWithReconfigurable(actualBase4)
254+
test.That(t, err, test.ShouldBeNil)
255+
test.That(t, reconfBase4, test.ShouldNotBeNil)
256+
257+
err = reconfBase3.Reconfigure(context.Background(), reconfBase4)
258+
test.That(t, err, test.ShouldBeNil)
259+
test.That(t, reconfBase3, test.ShouldResemble, reconfBase4)
240260
}
241261

242262
func TestClose(t *testing.T) {

0 commit comments

Comments
 (0)