@@ -14,6 +14,8 @@ import (
1414
1515var errStore = errors .New ("store error" )
1616
17+ const ifName = "eth0"
18+
1719func TestManager (t * testing.T ) {
1820 RegisterFailHandler (Fail )
1921 RunSpecs (t , "Manager Suite" )
@@ -23,7 +25,6 @@ var _ = Describe("Test Manager", func() {
2325 Describe ("Test AddExternalInterface" , func () {
2426 Context ("When adding the external interface" , func () {
2527 It ("Should not write to the store" , func () {
26- ifName := "eth0"
2728 // accessing the store should result in an error
2829 dataStore := & testutils.KeyValueStoreMock {
2930 WriteError : errStore ,
@@ -45,7 +46,6 @@ var _ = Describe("Test Manager", func() {
4546 Describe ("Test deleteExternalInterface" , func () {
4647 Context ("When external interface not found" , func () {
4748 It ("Should return nil" , func () {
48- ifName := "eth0"
4949 nm := & networkManager {
5050 ExternalInterfaces : map [string ]* externalInterface {},
5151 }
@@ -56,7 +56,6 @@ var _ = Describe("Test Manager", func() {
5656
5757 Context ("When external interface found" , func () {
5858 It ("Should delete external interface" , func () {
59- ifName := "eth0"
6059 nm := & networkManager {
6160 ExternalInterfaces : map [string ]* externalInterface {},
6261 }
@@ -102,7 +101,7 @@ var _ = Describe("Test Manager", func() {
102101
103102 Context ("When GetModificationTime error and not rebooted" , func () {
104103 It ("Should populate pointers" , func () {
105- extIfName := "eth0"
104+ extIfName := ifName
106105 nwId := "nwId"
107106 nm := & networkManager {
108107 store : & testutils.KeyValueStoreMock {
@@ -159,14 +158,13 @@ var _ = Describe("Test Manager", func() {
159158 nm := & networkManager {
160159 ExternalInterfaces : map [string ]* externalInterface {},
161160 }
162- num := nm .GetNumberOfEndpoints ("eth0" , "" )
161+ num := nm .GetNumberOfEndpoints (ifName , "" )
163162 Expect (num ).To (Equal (0 ))
164163 })
165164 })
166165
167166 Context ("When Networks is nil" , func () {
168167 It ("Should return 0" , func () {
169- ifName := "eth0"
170168 nm := & networkManager {
171169 ExternalInterfaces : map [string ]* externalInterface {},
172170 }
@@ -178,7 +176,6 @@ var _ = Describe("Test Manager", func() {
178176
179177 Context ("When network not found" , func () {
180178 It ("Should return 0" , func () {
181- ifName := "eth0"
182179 nm := & networkManager {
183180 ExternalInterfaces : map [string ]* externalInterface {},
184181 }
@@ -192,7 +189,6 @@ var _ = Describe("Test Manager", func() {
192189
193190 Context ("When endpoints is nil" , func () {
194191 It ("Should return 0" , func () {
195- ifName := "eth0"
196192 nwId := "nwId"
197193 nm := & networkManager {
198194 ExternalInterfaces : map [string ]* externalInterface {},
@@ -208,7 +204,6 @@ var _ = Describe("Test Manager", func() {
208204
209205 Context ("When endpoints is found" , func () {
210206 It ("Should return the length of endpoints" , func () {
211- ifName := "eth0"
212207 nwId := "nwId"
213208 nm := & networkManager {
214209 ExternalInterfaces : map [string ]* externalInterface {},
0 commit comments