Add explicit refresh interval to ES mappings

Fix queue tests
This commit is contained in:
allegroai 2023-07-26 18:53:10 +03:00
parent 21ed8559bf
commit 74acaa31df
4 changed files with 22 additions and 7 deletions

View File

@ -1,8 +1,8 @@
{ {
"index_patterns": "events-*", "index_patterns": "events-*",
"settings": { "settings": {
"number_of_shards": 1, "number_of_replicas": 0,
"number_of_replicas": 0 "number_of_shards": 1
}, },
"mappings": { "mappings": {
"_source": { "_source": {

View File

@ -1,8 +1,8 @@
{ {
"index_patterns": "queue_metrics_*", "index_patterns": "queue_metrics_*",
"settings": { "settings": {
"number_of_shards": 1, "number_of_replicas": 0,
"number_of_replicas": 0 "number_of_shards": 1
}, },
"mappings": { "mappings": {
"_source": { "_source": {
@ -20,6 +20,9 @@
}, },
"queue_length": { "queue_length": {
"type": "integer" "type": "integer"
},
"company_id": {
"type": "keyword"
} }
} }
} }

View File

@ -1,8 +1,8 @@
{ {
"index_patterns": "worker_stats_*", "index_patterns": "worker_stats_*",
"settings": { "settings": {
"number_of_shards": 1, "number_of_replicas": 0,
"number_of_replicas": 0 "number_of_shards": 1
}, },
"mappings": { "mappings": {
"_source": { "_source": {
@ -32,6 +32,9 @@
}, },
"task": { "task": {
"type": "keyword" "type": "keyword"
},
"company_id": {
"type": "keyword"
} }
} }
} }

View File

@ -9,6 +9,10 @@ from apiserver.tests.automated import TestService, utc_now_tz_aware
class TestQueues(TestService): class TestQueues(TestService):
def setUp(self, **kwargs):
super().setUp(**kwargs)
self.user = self.api.users.get_current_user().user
def test_default_queue(self): def test_default_queue(self):
res = self.api.queues.get_default() res = self.api.queues.get_default()
self.assertIsNotNone(res.id) self.assertIsNotNone(res.id)
@ -313,4 +317,9 @@ class TestQueues(TestService):
machine_stats=dict(cpu_usage=[10, 20]), machine_stats=dict(cpu_usage=[10, 20]),
task=task["id"], task=task["id"],
) )
return dict(name=worker, ip="127.0.0.1", task=task) return dict(
name=worker,
ip="127.0.0.1",
task=task,
key=f"worker_{self.user.company.id}_{self.user.id}_{worker}"
)