~mvo/snappy/15.04-lp1493389-gio

« back to all changes in this revision

Viewing changes to systemd/systemd_test.go

Backport of the trunk branch by mvo approved by chipaca

Show diffs side-by-side

added added

removed removed

Lines of Context:
169
169
        expectedAppService  = fmt.Sprintf(expectedServiceFmt, "After=ubuntu-snappy.frameworks.target\nRequires=ubuntu-snappy.frameworks.target", ".mvo", "mvo", "\n", helpers.UbuntuArchitecture())
170
170
        expectedFmkService  = fmt.Sprintf(expectedServiceFmt, "Before=ubuntu-snappy.frameworks.target\nAfter=ubuntu-snappy.frameworks-pre.target\nRequires=ubuntu-snappy.frameworks-pre.target", "", "", "\n", helpers.UbuntuArchitecture())
171
171
        expectedDbusService = fmt.Sprintf(expectedServiceFmt, "After=ubuntu-snappy.frameworks.target\nRequires=ubuntu-snappy.frameworks.target", ".mvo", "mvo", "BusName=foo.bar.baz\nType=dbus", helpers.UbuntuArchitecture())
 
172
 
 
173
        // things that need network
 
174
        expectedNetAppService = fmt.Sprintf(expectedServiceFmt, "After=ubuntu-snappy.frameworks.target\nRequires=ubuntu-snappy.frameworks.target\nAfter=snappy-wait4network.service\nRequires=snappy-wait4network.service", ".mvo", "mvo", "\n", helpers.UbuntuArchitecture())
 
175
        expectedNetFmkService = fmt.Sprintf(expectedServiceFmt, "Before=ubuntu-snappy.frameworks.target\nAfter=ubuntu-snappy.frameworks-pre.target\nRequires=ubuntu-snappy.frameworks-pre.target\nAfter=snappy-wait4network.service\nRequires=snappy-wait4network.service", "", "", "\n", helpers.UbuntuArchitecture())
172
176
)
173
177
 
174
178
func (s *SystemdTestSuite) TestGenAppServiceFile(c *C) {
190
194
        c.Check(New("", nil).GenServiceFile(desc), Equals, expectedAppService)
191
195
}
192
196
 
 
197
func (s *SystemdTestSuite) TestGenNetAppServiceFile(c *C) {
 
198
 
 
199
        desc := &ServiceDescription{
 
200
                AppName:     "app",
 
201
                ServiceName: "service",
 
202
                Version:     "1.0",
 
203
                Description: "descr",
 
204
                AppPath:     "/apps/app.mvo/1.0/",
 
205
                Start:       "bin/start",
 
206
                Stop:        "bin/stop",
 
207
                PostStop:    "bin/stop --post",
 
208
                StopTimeout: time.Duration(10 * time.Second),
 
209
                AaProfile:   "aa-profile",
 
210
                IsNetworked: true,
 
211
                UdevAppName: "app.mvo",
 
212
        }
 
213
 
 
214
        c.Check(New("", nil).GenServiceFile(desc), Equals, expectedNetAppService)
 
215
}
 
216
 
193
217
func (s *SystemdTestSuite) TestGenFmkServiceFile(c *C) {
194
218
 
195
219
        desc := &ServiceDescription{
210
234
        c.Check(New("", nil).GenServiceFile(desc), Equals, expectedFmkService)
211
235
}
212
236
 
 
237
func (s *SystemdTestSuite) TestGenNetFmkServiceFile(c *C) {
 
238
 
 
239
        desc := &ServiceDescription{
 
240
                AppName:     "app",
 
241
                ServiceName: "service",
 
242
                Version:     "1.0",
 
243
                Description: "descr",
 
244
                AppPath:     "/apps/app/1.0/",
 
245
                Start:       "bin/start",
 
246
                Stop:        "bin/stop",
 
247
                PostStop:    "bin/stop --post",
 
248
                StopTimeout: time.Duration(10 * time.Second),
 
249
                AaProfile:   "aa-profile",
 
250
                IsNetworked: true,
 
251
                IsFramework: true,
 
252
                UdevAppName: "app",
 
253
        }
 
254
 
 
255
        c.Check(New("", nil).GenServiceFile(desc), Equals, expectedNetFmkService)
 
256
}
 
257
 
213
258
func (s *SystemdTestSuite) TestGenServiceFileWithBusName(c *C) {
214
259
 
215
260
        desc := &ServiceDescription{