1
0
mirror of https://github.com/mariadb-corporation/mariadb-columnstore-engine.git synced 2025-08-10 01:22:48 +03:00
Files
mariadb-columnstore-engine/cmapi/cmapi_server/test/config_apply_example.py
Leonid Fedorov e2367a9495 CI from develop + cmapi [develop-23.02] (#2863)
* MCOL-5496: Merge CMAPI code to engine repo.

[add] cmapi code to engine

* MCOL-5496: Fix CI adding CMAPI steps.

[fix] deb packages deps commands
[add] several additional local variables
[fix] packages url
[fix] smoke step
[fix] mtr step
[fix] regression step
[add] cmapipython, cmapibuild, cmapitest and cmapilog steps
[fix] dockerfile step
[fix] build step to include cmapi package on repodata creating
[fix] multi_node_mtr step
[fix] pkg step
[add] cmapi steps to pipelines
[fix] cmapi/CMakeLists.txt to prevent cmake byte-compile .py files for rpm packages
[add] setup-repo.sh file
[fix] now use packages from the repos in tests steps

* Adding color 2 build script

* Build script and logging scripts from develop

* Remove test 222 from full regression, it is missing in 23.02 regression set

---------

Co-authored-by: mariadb-AlanMologorsky <alan.mologorsky@mariadb.com>
Co-authored-by: mariadb-RomanNavrotskiy <roman.navrotskiy@mariadb.com>
2023-06-09 17:36:17 +03:00

51 lines
1.3 KiB
Python

import unittest
import requests
import configparser
from pathlib import Path
from datetime import datetime
from cmapi_server.controllers.dispatcher import _version
config_filename = './cmapi_server/cmapi_server.conf'
url = f"https://localhost:8640/cmapi/{_version}/node/config"
begin_url = f"https://localhost:8640/cmapi/{_version}/node/begin"
config_path = './cmapi_server/test/Columnstore_apply_config.xml'
# create tmp dir
tmp_prefix = '/tmp/mcs_config_test'
tmp_path = Path(tmp_prefix)
tmp_path.mkdir(parents = True, exist_ok = True)
copyfile(config_path_old, tmp_prefix + '/Columnstore.xml')
def get_current_key():
app_config = configparser.ConfigParser()
try:
with open(config_filename, 'r') as _config_file:
app_config.read_file(_config_file)
except FileNotFoundError:
return ''
if 'Authentication' not in app_config.sections():
return ''
return app_config['Authentication'].get('x-api-key', '')
headers = {'x-api-key': get_current_key()}
body = {'id': 42, 'timeout': 120}
r = requests.put(begin_url, verify=False, headers=headers, json=body)
config_file = Path(config_path)
config = config_file.read_text()
body = {
'revision': 42,
'manager': '1.1.1.1',
'timeout': 0,
'config': config,
}
#print(config)
#r = requests.put(url, verify=False, headers=headers, json=body)