~allenap/maas/xxx-a-thon

« back to all changes in this revision

Viewing changes to src/maasserver/tests/test_plugin.py

  • Committer: Gavin Panella
  • Date: 2016-03-22 21:14:34 UTC
  • mfrom: (4657.1.157 maas)
  • Revision ID: gavin.panella@canonical.com-20160322211434-xzuovio86zvzo2js
Merge trunk.

Show diffs side-by-side

added added

removed removed

Lines of Context:
82
82
        service_maker = RegionServiceMaker("Harry", "Hill")
83
83
        # Disable _configureThreads() as it's too invasive right now.
84
84
        self.patch_autospec(service_maker, "_configureThreads")
 
85
        # Disable _preformStartUp() as it performs operations we don't want
 
86
        # in the testing environment.
 
87
        self.patch_autospec(service_maker, "_performStartUp")
85
88
        service = service_maker.makeService(options)
86
89
        self.assertIsInstance(service, MultiService)
87
90
        expected_services = [
93
96
            "rpc-advertise",
94
97
            "postgres-listener",
95
98
            "status-monitor",
 
99
            "service-monitor",
 
100
            "system-controller",
96
101
            "web",
97
102
        ]
98
103
        self.assertItemsEqual(expected_services, service.namedServices)
112
117
        patcher.patch()
113
118
        try:
114
119
            service_maker = RegionServiceMaker("Harry", "Hill")
 
120
            # Disable _preformStartUp() as it performs operations we don't want
 
121
            # in the testing environment.
 
122
            self.patch_autospec(service_maker, "_performStartUp")
115
123
            service_maker.makeService(Options())
116
124
            threadpool = reactor.getThreadPool()
117
125
            self.assertThat(threadpool, IsInstance(ThreadPool))
136
144
        service_maker = RegionServiceMaker("Harry", "Hill")
137
145
        # Disable _configureThreads() as it's too invasive right now.
138
146
        self.patch_autospec(service_maker, "_configureThreads")
 
147
        # Disable _preformStartUp() as it performs operations we don't want
 
148
        # in the testing environment.
 
149
        self.patch_autospec(service_maker, "_performStartUp")
139
150
        service_maker.makeService(Options())
140
151
        self.assertConnectionsDisabled()
 
152
 
 
153
    @asynchronous(timeout=5)
 
154
    def test_runs_start_up(self):
 
155
        service_maker = RegionServiceMaker("Harry", "Hill")
 
156
        # Disable _configureThreads() as it's too invasive right now.
 
157
        self.patch_autospec(service_maker, "_configureThreads")
 
158
        # Disable _preformStartUp() as it performs operations we don't want
 
159
        # in the testing environment.
 
160
        mock_performStartUp = self.patch_autospec(
 
161
            service_maker, "_performStartUp")
 
162
        service_maker.makeService(Options())
 
163
        self.assertThat(mock_performStartUp, MockCalledOnceWith())