-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathtest_quota.py
More file actions
33 lines (27 loc) · 1.01 KB
/
test_quota.py
File metadata and controls
33 lines (27 loc) · 1.01 KB
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
"""
Unit tests for the Drycc scheduler module.
Run the tests with './manage.py test scheduler'
"""
from scheduler.tests import TestCase
from scheduler import KubeHTTPException
class QuotaTest(TestCase):
def test_create_quota(self):
namespace_name = self.create_namespace()
spec = {
'hard': {
'cpu': '3',
'pods': '10',
'secrets': '5'
}
}
self.scheduler.quota.create(namespace_name, 'test1', spec=spec)
response = self.scheduler.quota.get(namespace_name, 'test1')
data = response.json()
self.assertEqual(data.get('spec', {}), spec)
self.assertEqual(data['metadata']['namespace'], namespace_name)
def test_create_with_nonexistent_namespace(self):
with self.assertRaises(
KubeHTTPException,
msg='failed to create quota test1 for namespace ghost-namespace: 404 Not Found'
):
self.scheduler.quota.create('ghost-namespace', 'test1', data={})