Skip to content

Commit 7cc04fc

Browse files
committed
chore(test): use parallel
1 parent 6cf77d9 commit 7cc04fc

4 files changed

Lines changed: 8 additions & 10 deletions

File tree

charts/controller/templates/_helpers.tpl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ env:
126126
key: victoriametrics-url
127127
{{- else if .Values.victoriametrics.enabled }}
128128
- name: "DRYCC_VICTORIAMETRICS_URL"
129-
value: "http://drycc-victoriametrics-vmselect:8481"
129+
value: "http://drycc-victoriametrics-vmselect:8481/select/multitenant/prometheus"
130130
{{- end }}
131131
{{- if .Values.passport.enabled }}
132132
- name: "DRYCC_PASSPORT_URL"

charts/controller/templates/metric/controller-metric-service.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ spec:
1414
clusterIP: None
1515
ports:
1616
- name: http
17-
port: 80
17+
port: 8000
1818
targetPort: 8000
1919
selector:
2020
app: drycc-controller

rootfs/api/views.py

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1325,7 +1325,7 @@ async def authenticate(self, request, username):
13251325
if self.permission.has_permission(request, None):
13261326
if username != "drycc":
13271327
return None, {'error': 'Access denied', "status_code": 403}
1328-
return -1, None
1328+
return 0, None
13291329
auth = await database_sync_to_async(self.authentication.authenticate)(request)
13301330
if not auth or len(auth) != 2:
13311331
return None, {'error': 'Unauthorized', "status_code": 401}
@@ -1448,15 +1448,13 @@ async def proxy(self, request, username, path):
14481448
user_id, message = await self.authenticate(request, username)
14491449
if user_id is None and message is not None:
14501450
return JsonResponse(message, status=message["status_code"])
1451-
if username == "drycc":
1452-
path = f"/select/0/prometheus/{path}"
1453-
else:
1454-
path = f"/select/{user_id}/prometheus/{path}"
1451+
data = dict(request.GET) if request.method == "GET" else dict(request.POST)
1452+
data['extra_filters[]'] = '{vm_account_id="%s"}' % user_id
14551453
try:
14561454
async with aiohttp.ClientSession() as session:
14571455
async with session.post(
1458-
urljoin(settings.DRYCC_VICTORIAMETRICS_URL, path),
1459-
data=dict(request.GET) if request.method == "GET" else dict(request.POST),
1456+
f"{settings.DRYCC_VICTORIAMETRICS_URL.rstrip("/")}/{path}",
1457+
data=data,
14601458
headers={"Content-Type": "application/x-www-form-urlencoded"},
14611459
timeout=self.timeout
14621460
) as response:

rootfs/bin/test-unit

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,4 +15,4 @@ function start_valkey() {
1515
gosu postgres pg_ctl -D "$PGDATA" start && ln -s /tmp/.s.PGSQL.5432 /var/run/postgresql/.s.PGSQL.5432
1616
start_valkey
1717
python3 manage.py check
18-
coverage run --source=api,scheduler manage.py test --settings=api.settings.testing --noinput api scheduler.tests --exclude-tag=auth
18+
coverage run --source=api,scheduler manage.py test --settings=api.settings.testing --noinput api scheduler.tests --exclude-tag=auth --parallel="${TEST_PARALLEL:-8}"

0 commit comments

Comments
 (0)