Ubuntu Pastebin

Paste from zyga at Fri, 7 Apr 2017 10:07:24 +0000

Download as text
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
zyga@fyke:~/snapd/snap$ go test

----------------------------------------------------------------------
FAIL: info_test.go:528: infoSuite.TestRenamePlug

info_test.go:529:
    snapInfo := snaptest.MockInfo(c, `name: core
    plugs:
      old:
        interface: iface
    slots:
      old:
        interface: iface
    apps:
      app:
    hooks:
      configure:
    `, nil)
snaptest/snaptest.go:78:
    c.Assert(err, check.IsNil)
... value *errors.errorString = &errors.errorString{s:"cannot have plug and slot with the same name: \"old\""} ("cannot have plug and slot with the same name: \"old\"")

OOPS: 144 passed, 1 FAILED
--- FAIL: Test (0.18s)
FAIL
exit status 1
FAIL	github.com/snapcore/snapd/snap	0.186s
zyga@fyke:~/snapd/snap$ fg
vim info_test.go

[1]+  Zatrzymano              vim info_test.go
zyga@fyke:~/snapd/snap$ git diff
diff --git a/snap/info_test.go b/snap/info_test.go
index 17f6f5c..b68e12a 100644
--- a/snap/info_test.go
+++ b/snap/info_test.go
@@ -530,6 +530,9 @@ func (s *infoSuite) TestRenamePlug(c *C) {
 plugs:
   old:
     interface: iface
+slots:
+  old:
+    interface: iface
 apps:
   app:
 hooks:
@@ -537,13 +540,16 @@ hooks:
 `, nil)
        c.Assert(snapInfo.Plugs["old"], Not(IsNil))
        c.Assert(snapInfo.Plugs["old"].Name, Equals, "old")
+       c.Assert(snapInfo.Slots["old"], Not(IsNil))
+       c.Assert(snapInfo.Slots["old"].Name, Equals, "old")
        c.Assert(snapInfo.Apps["app"].Plugs["old"], DeepEquals, snapInfo.Plugs["old"])
+       c.Assert(snapInfo.Apps["app"].Slots["old"], DeepEquals, snapInfo.Plugs["old"])
        c.Assert(snapInfo.Hooks["configure"].Plugs["old"], DeepEquals, snapInfo.Plugs["old"])
 
        // Rename the plug now.
        snapInfo.RenamePlug("old", "new")
 
-       // Check that there's no trace of the old name.
+       // Check that there's no trace of the old plug name.
        c.Assert(snapInfo.Plugs["old"], IsNil)
        c.Assert(snapInfo.Plugs["new"], Not(IsNil))
        c.Assert(snapInfo.Plugs["new"].Name, Equals, "new")
@@ -551,4 +557,9 @@ hooks:
        c.Assert(snapInfo.Apps["app"].Plugs["new"], DeepEquals, snapInfo.Plugs["new"])
        c.Assert(snapInfo.Hooks["configure"].Plugs["old"], IsNil)
        c.Assert(snapInfo.Hooks["configure"].Plugs["new"], DeepEquals, snapInfo.Plugs["new"])
+
+       // Check that slots with the old name are unaffected.
+       c.Assert(snapInfo.Slots["old"], Not(IsNil))
+       c.Assert(snapInfo.Slots["old"].Name, Equals, "old")
+       c.Assert(snapInfo.Apps["app"].Slots["old"], DeepEquals, snapInfo.Plugs["new"])
 }
Download as text