コード例 #1
0
    def test_app_b_start(self):
        name = "random_name"
        io.run_sync(profile.Upload(self.storage, "random_profile",
                                   "{}").execute,
                    timeout=2)
        result = io.run_sync(app.Start(self.node, name,
                                       "random_profile").execute,
                             timeout=2)
        assert "application `random_name` has been started with profile `random_profile`" == result, result

        result = io.run_sync(app.Check(self.node, self.storage, self.locator,
                                       name).execute,
                             timeout=2)
        assert result['state'] == "running"
コード例 #2
0
    def test_AppCheckActionReturnsStoppedOrMissingWhenApplicationIsNotFound(self):
        node = mock()
        storage = mock()
        locator = mock()
        action = app.Check(node, storage, locator, **{'name': 'AppName'})
        mockInfo = {
            'apps': {
            }
        }
        when(node).info().thenReturn(Chain([lambda: mockInfo]))
        actual = action.execute().get(timeout=0.1)

        verify(node).info()
        self.assertEqual({'AppName': 'stopped or missing'}, actual)
コード例 #3
0
    def test_AppCheckAction(self):
        node = mock()
        storage = mock()
        locator = mock()
        when(app.List).execute().thenReturn('AppName')
        action = app.Check(node, storage, locator, 'AppName')
        mockInfo = {
            'apps': {
                'AppName': {
                    'load-median': 0,
                    'profile': 'ProfileName',
                    'sessions': {
                        'pending': 0
                    },
                    'state': 'running',
                }
            }
        }
        when(node).info().thenReturn(mockInfo)
        actual = action.execute().get(timeout=0.1)

        verify(node).info()
        self.assertEqual({'AppName': 'running'}, actual)
コード例 #4
0
 def test_app_d_stop_after_check(self):
     name = "random_name"
     io.run_sync(app.Check(self.node, self.storage, self.locator,
                           name).execute,
                 timeout=2)
コード例 #5
0
 def test_check_no_appname(self):
     app.Check(self.node, self.storage, self.locator, "")
コード例 #6
0
 def test_check_no_such_app(self):
     io.run_sync(app.Check(self.node, self.storage, self.locator,
                           "no_such_app_name").execute,
                 timeout=2)