diff --git a/build_scripts/inference/metrics.py b/build_scripts/inference/metrics.py index d21cefdf..761ba50e 100755 --- a/build_scripts/inference/metrics.py +++ b/build_scripts/inference/metrics.py @@ -15,6 +15,7 @@ download_file_seconds = os.getenv('DOWNLOAD_FILE_SECONDS') decompress_seconds = os.getenv('DECOMPRESS_SECONDS') instance_init_seconds = os.getenv('INSTANCE_INIT_SECONDS') upload_endpoint_cache_seconds = os.getenv('UPLOAD_ENDPOINT_CACHE_SECONDS') +download_file_size = os.getenv('DOWNLOAD_FILE_SIZE') if service_type == 'sd': service_type = 'Stable-Diffusion' @@ -23,6 +24,28 @@ if service_type == 'comfy': service_type = 'Comfy' +def record_size(metric_name, size: float): + response = cloudwatch.put_metric_data( + Namespace='ESD', + MetricData=[ + { + 'MetricName': metric_name, + 'Dimensions': [ + { + 'Name': 'Service', + 'Value': service_type + }, + + ], + 'Timestamp': datetime.datetime.utcnow(), + 'Value': size, + 'Unit': 'Megabytes' + }, + ] + ) + logger.info(f"record_metric response: {response}") + + def record_seconds(metric_name, seconds): response = cloudwatch.put_metric_data( Namespace='ESD', @@ -61,3 +84,7 @@ if __name__ == "__main__": if upload_endpoint_cache_seconds is not None: upload_endpoint_cache_seconds = int(upload_endpoint_cache_seconds) record_seconds('UploadEndpointCacheSeconds', upload_endpoint_cache_seconds) + + if download_file_size is not None: + download_file_size = float(download_file_size) + record_size('DownloadFileSize', download_file_size) diff --git a/build_scripts/inference/start.sh b/build_scripts/inference/start.sh index 2dc7fc57..2fcff575 100644 --- a/build_scripts/inference/start.sh +++ b/build_scripts/inference/start.sh @@ -172,6 +172,8 @@ sd_launch_from_public_s3(){ export DOWNLOAD_FILE_SECONDS=$((end_at-start_at)) echo "download file: $DOWNLOAD_FILE_SECONDS seconds" + export DOWNLOAD_FILE_SIZE=$(du -sm /home/ubuntu/stable-diffusion-webui | awk '{print $1}' | grep -oE '[0-9]+') + start_at=$(date +%s) tar --overwrite -xf "$SERVICE_TYPE.tar" -C /home/ubuntu/ rm -rf "$SERVICE_TYPE.tar" @@ -310,6 +312,8 @@ comfy_launch_from_public_s3(){ export DOWNLOAD_FILE_SECONDS=$((end_at-start_at)) echo "download file: $DOWNLOAD_FILE_SECONDS seconds" + export DOWNLOAD_FILE_SIZE=$(du -sm /home/ubuntu/ComfyUI | awk '{print $1}' | grep -oE '[0-9]+') + start_at=$(date +%s) tar --overwrite -xf "$SERVICE_TYPE.tar" -C /home/ubuntu/ rm -rf "$SERVICE_TYPE.tar" diff --git a/test/test_06_api_inference/test_11_txt2img_async_cn_2.py b/test/test_06_api_inference/test_11_txt2img_async_cn_2.py index 28719d39..1c85d2e3 100644 --- a/test/test_06_api_inference/test_11_txt2img_async_cn_2.py +++ b/test/test_06_api_inference/test_11_txt2img_async_cn_2.py @@ -25,6 +25,31 @@ class TestTxt2ImgInferenceAsyncCn2E2E: def teardown_class(cls): pass + def test_0_update_api_roles(self): + headers = { + "x-api-key": config.api_key, + "username": config.username, + } + + data = { + "username": "api", + "password": "admin", + "creator": "api", + "roles": [ + 'IT Operator', + 'byoc', + config.role_sd_real_time, + config.role_sd_async, + config.role_comfy_async, + config.role_comfy_real_time, + ], + } + + resp = self.api.create_user(headers=headers, data=data) + + assert resp.status_code == 201, resp.dumps() + assert resp.json()["statusCode"] == 201 + def test_1_txt2img_async_create(self): headers = { "x-api-key": config.api_key, diff --git a/test/test_06_api_inference/test_12_txt2img_async_cn_3.py b/test/test_06_api_inference/test_12_txt2img_async_cn_3.py index 31657fb1..633f1c0c 100644 --- a/test/test_06_api_inference/test_12_txt2img_async_cn_3.py +++ b/test/test_06_api_inference/test_12_txt2img_async_cn_3.py @@ -25,6 +25,31 @@ class TestTxt2ImgInferenceAsyncCn3E2E: def teardown_class(cls): pass + def test_0_update_api_roles(self): + headers = { + "x-api-key": config.api_key, + "username": config.username, + } + + data = { + "username": "api", + "password": "admin", + "creator": "api", + "roles": [ + 'IT Operator', + 'byoc', + config.role_sd_real_time, + config.role_sd_async, + config.role_comfy_async, + config.role_comfy_real_time, + ], + } + + resp = self.api.create_user(headers=headers, data=data) + + assert resp.status_code == 201, resp.dumps() + assert resp.json()["statusCode"] == 201 + def test_1_txt2img_async_create(self): headers = { "x-api-key": config.api_key, diff --git a/test/test_06_api_inference/test_13_txt2img_async.py b/test/test_06_api_inference/test_13_txt2img_async.py index 00eb1e5b..4ae6277c 100644 --- a/test/test_06_api_inference/test_13_txt2img_async.py +++ b/test/test_06_api_inference/test_13_txt2img_async.py @@ -25,6 +25,31 @@ class TestTxt2ImgInferenceAsyncE2E: def teardown_class(self): pass + def test_0_update_api_roles(self): + headers = { + "x-api-key": config.api_key, + "username": config.username, + } + + data = { + "username": "api", + "password": "admin", + "creator": "api", + "roles": [ + 'IT Operator', + 'byoc', + config.role_sd_real_time, + config.role_sd_async, + config.role_comfy_async, + config.role_comfy_real_time, + ], + } + + resp = self.api.create_user(headers=headers, data=data) + + assert resp.status_code == 201, resp.dumps() + assert resp.json()["statusCode"] == 201 + def test_1_txt2img_async_create(self): headers = { "x-api-key": config.api_key, diff --git a/test/test_06_api_inference/test_14_txt2img_real_time.py b/test/test_06_api_inference/test_14_txt2img_real_time.py index 2afbf9a7..4c00b6e5 100644 --- a/test/test_06_api_inference/test_14_txt2img_real_time.py +++ b/test/test_06_api_inference/test_14_txt2img_real_time.py @@ -22,6 +22,31 @@ class TestTxt2ImgInferenceRealTimeE2E: def teardown_class(cls): pass + def test_0_update_api_roles(self): + headers = { + "x-api-key": config.api_key, + "username": config.username, + } + + data = { + "username": "api", + "password": "admin", + "creator": "api", + "roles": [ + 'IT Operator', + 'byoc', + config.role_sd_real_time, + config.role_sd_async, + config.role_comfy_async, + config.role_comfy_real_time, + ], + } + + resp = self.api.create_user(headers=headers, data=data) + + assert resp.status_code == 201, resp.dumps() + assert resp.json()["statusCode"] == 201 + def test_1_txt2img_real_time_create(self): headers = { "x-api-key": config.api_key, diff --git a/test/test_06_api_inference/test_15_txt2img_reactor_async.py b/test/test_06_api_inference/test_15_txt2img_reactor_async.py index 7110d5b4..e108f7f6 100644 --- a/test/test_06_api_inference/test_15_txt2img_reactor_async.py +++ b/test/test_06_api_inference/test_15_txt2img_reactor_async.py @@ -25,6 +25,31 @@ class TestTxt2ImgReactorAsyncE2E: def teardown_class(self): pass + def test_0_update_api_roles(self): + headers = { + "x-api-key": config.api_key, + "username": config.username, + } + + data = { + "username": "api", + "password": "admin", + "creator": "api", + "roles": [ + 'IT Operator', + 'byoc', + config.role_sd_real_time, + config.role_sd_async, + config.role_comfy_async, + config.role_comfy_real_time, + ], + } + + resp = self.api.create_user(headers=headers, data=data) + + assert resp.status_code == 201, resp.dumps() + assert resp.json()["statusCode"] == 201 + def test_1_txt2img_reactor_async_create(self): headers = { "x-api-key": config.api_key, diff --git a/test/test_06_api_inference/test_20_esi_async.py b/test/test_06_api_inference/test_20_esi_async.py index a455e058..2f84f4d2 100644 --- a/test/test_06_api_inference/test_20_esi_async.py +++ b/test/test_06_api_inference/test_20_esi_async.py @@ -25,6 +25,31 @@ class TestEsiInferenceAsyncE2E: def teardown_class(cls): pass + def test_0_update_api_roles(self): + headers = { + "x-api-key": config.api_key, + "username": config.username, + } + + data = { + "username": "api", + "password": "admin", + "creator": "api", + "roles": [ + 'IT Operator', + 'byoc', + config.role_sd_real_time, + config.role_sd_async, + config.role_comfy_async, + config.role_comfy_real_time, + ], + } + + resp = self.api.create_user(headers=headers, data=data) + + assert resp.status_code == 201, resp.dumps() + assert resp.json()["statusCode"] == 201 + def test_1_esi_async_create(self): headers = { "x-api-key": config.api_key, diff --git a/test/test_06_api_inference/test_21_esi_real_time.py b/test/test_06_api_inference/test_21_esi_real_time.py index 5fbc5a08..60e13ade 100644 --- a/test/test_06_api_inference/test_21_esi_real_time.py +++ b/test/test_06_api_inference/test_21_esi_real_time.py @@ -22,6 +22,31 @@ class TestEsiRealTimeE2E: def teardown_class(cls): pass + def test_0_update_api_roles(self): + headers = { + "x-api-key": config.api_key, + "username": config.username, + } + + data = { + "username": "api", + "password": "admin", + "creator": "api", + "roles": [ + 'IT Operator', + 'byoc', + config.role_sd_real_time, + config.role_sd_async, + config.role_comfy_async, + config.role_comfy_real_time, + ], + } + + resp = self.api.create_user(headers=headers, data=data) + + assert resp.status_code == 201, resp.dumps() + assert resp.json()["statusCode"] == 201 + def test_1_esi_real_time_create(self): headers = { "x-api-key": config.api_key, diff --git a/test/test_06_api_inference/test_30_img2img_async.py b/test/test_06_api_inference/test_30_img2img_async.py index 1947fe4d..27077b48 100644 --- a/test/test_06_api_inference/test_30_img2img_async.py +++ b/test/test_06_api_inference/test_30_img2img_async.py @@ -25,6 +25,31 @@ class TestImg2ImgInferenceAsyncE2E: def teardown_class(self): pass + def test_0_update_api_roles(self): + headers = { + "x-api-key": config.api_key, + "username": config.username, + } + + data = { + "username": "api", + "password": "admin", + "creator": "api", + "roles": [ + 'IT Operator', + 'byoc', + config.role_sd_real_time, + config.role_sd_async, + config.role_comfy_async, + config.role_comfy_real_time, + ], + } + + resp = self.api.create_user(headers=headers, data=data) + + assert resp.status_code == 201, resp.dumps() + assert resp.json()["statusCode"] == 201 + def test_1_img2img_async_create(self): headers = { "x-api-key": config.api_key, diff --git a/test/test_06_api_inference/test_31_img2img_real_time.py b/test/test_06_api_inference/test_31_img2img_real_time.py index 1a02253f..56a7874a 100644 --- a/test/test_06_api_inference/test_31_img2img_real_time.py +++ b/test/test_06_api_inference/test_31_img2img_real_time.py @@ -22,6 +22,31 @@ class TestImg2ImgInferenceRealTimeE2E: def teardown_class(self): pass + def test_0_update_api_roles(self): + headers = { + "x-api-key": config.api_key, + "username": config.username, + } + + data = { + "username": "api", + "password": "admin", + "creator": "api", + "roles": [ + 'IT Operator', + 'byoc', + config.role_sd_real_time, + config.role_sd_async, + config.role_comfy_async, + config.role_comfy_real_time, + ], + } + + resp = self.api.create_user(headers=headers, data=data) + + assert resp.status_code == 201, resp.dumps() + assert resp.json()["statusCode"] == 201 + def test_1_img2img_real_time_create(self): headers = { "x-api-key": config.api_key, diff --git a/test/test_06_api_inference/test_40_rembg_async.py b/test/test_06_api_inference/test_40_rembg_async.py index dac39218..0df9b986 100644 --- a/test/test_06_api_inference/test_40_rembg_async.py +++ b/test/test_06_api_inference/test_40_rembg_async.py @@ -25,6 +25,31 @@ class TestRembgInferenceAsyncE2E: def teardown_class(self): pass + def test_0_update_api_roles(self): + headers = { + "x-api-key": config.api_key, + "username": config.username, + } + + data = { + "username": "api", + "password": "admin", + "creator": "api", + "roles": [ + 'IT Operator', + 'byoc', + config.role_sd_real_time, + config.role_sd_async, + config.role_comfy_async, + config.role_comfy_real_time, + ], + } + + resp = self.api.create_user(headers=headers, data=data) + + assert resp.status_code == 201, resp.dumps() + assert resp.json()["statusCode"] == 201 + def test_1_rembg_async_create(self): headers = { "x-api-key": config.api_key, diff --git a/test/test_06_api_inference/test_40_sla_txt2img_async.py b/test/test_06_api_inference/test_40_sla_txt2img_async.py index 966382e2..512f796d 100644 --- a/test/test_06_api_inference/test_40_sla_txt2img_async.py +++ b/test/test_06_api_inference/test_40_sla_txt2img_async.py @@ -30,6 +30,31 @@ class TestSLaTxt2ImgAsync: def teardown_class(self): pass + def test_0_update_api_roles(self): + headers = { + "x-api-key": config.api_key, + "username": config.username, + } + + data = { + "username": "api", + "password": "admin", + "creator": "api", + "roles": [ + 'IT Operator', + 'byoc', + config.role_sd_real_time, + config.role_sd_async, + config.role_comfy_async, + config.role_comfy_real_time, + ], + } + + resp = self.api.create_user(headers=headers, data=data) + + assert resp.status_code == 201, resp.dumps() + assert resp.json()["statusCode"] == 201 + @pytest.mark.skipif(config.test_fast, reason="test_fast") def test_1_sla_txt2img(self): diff --git a/test/test_06_api_inference/test_41_sd_xl_turbo.py b/test/test_06_api_inference/test_41_sd_xl_turbo.py index db025828..34a3f85a 100644 --- a/test/test_06_api_inference/test_41_sd_xl_turbo.py +++ b/test/test_06_api_inference/test_41_sd_xl_turbo.py @@ -30,6 +30,31 @@ class TestTurboE2E: def teardown_class(self): pass + def test_0_update_api_roles(self): + headers = { + "x-api-key": config.api_key, + "username": config.username, + } + + data = { + "username": "api", + "password": "admin", + "creator": "api", + "roles": [ + 'IT Operator', + 'byoc', + config.role_sd_real_time, + config.role_sd_async, + config.role_comfy_async, + config.role_comfy_real_time, + ], + } + + resp = self.api.create_user(headers=headers, data=data) + + assert resp.status_code == 201, resp.dumps() + assert resp.json()["statusCode"] == 201 + def test_0_delete_checkpoints_turbo(self): headers = { "x-api-key": config.api_key, diff --git a/test/test_06_api_inference/test_50_tps_real_time.py b/test/test_06_api_inference/test_50_tps_real_time.py index 37764905..30fc5075 100644 --- a/test/test_06_api_inference/test_50_tps_real_time.py +++ b/test/test_06_api_inference/test_50_tps_real_time.py @@ -40,7 +40,32 @@ class TestTpsRealTimeE2E: def teardown_class(cls): pass - def test_0_clear_inferences_jobs(self): + def test_0_update_api_roles(self): + headers = { + "x-api-key": config.api_key, + "username": config.username, + } + + data = { + "username": "api", + "password": "admin", + "creator": "api", + "roles": [ + 'IT Operator', + 'byoc', + config.role_sd_real_time, + config.role_sd_async, + config.role_comfy_async, + config.role_comfy_real_time, + ], + } + + resp = self.api.create_user(headers=headers, data=data) + + assert resp.status_code == 201, resp.dumps() + assert resp.json()["statusCode"] == 201 + + def test_1_clear_inferences_jobs(self): headers = { "x-api-key": config.api_key, "username": config.username @@ -56,7 +81,7 @@ class TestTpsRealTimeE2E: } self.api.delete_inferences(data=data, headers=headers) - def test_1_start_real_time_tps(self): + def test_2_start_real_time_tps(self): ids = [] for i in range(20): diff --git a/test/test_06_api_inference/test_51_rembg_real_time.py b/test/test_06_api_inference/test_51_rembg_real_time.py index 068bbd8e..d1b5709c 100644 --- a/test/test_06_api_inference/test_51_rembg_real_time.py +++ b/test/test_06_api_inference/test_51_rembg_real_time.py @@ -22,6 +22,31 @@ class TestRembgRealTimeE2E: def teardown_class(self): pass + def test_0_update_api_roles(self): + headers = { + "x-api-key": config.api_key, + "username": config.username, + } + + data = { + "username": "api", + "password": "admin", + "creator": "api", + "roles": [ + 'IT Operator', + 'byoc', + config.role_sd_real_time, + config.role_sd_async, + config.role_comfy_async, + config.role_comfy_real_time, + ], + } + + resp = self.api.create_user(headers=headers, data=data) + + assert resp.status_code == 201, resp.dumps() + assert resp.json()["statusCode"] == 201 + def test_1_rembg_real_time_create(self): headers = { "x-api-key": config.api_key, diff --git a/test/test_06_api_inference/test_70_one_api_async.py b/test/test_06_api_inference/test_70_one_api_async.py index 8e41fd2d..5c846d42 100644 --- a/test/test_06_api_inference/test_70_one_api_async.py +++ b/test/test_06_api_inference/test_70_one_api_async.py @@ -23,6 +23,31 @@ class TestInferenceOneApiAsyncE2E: def teardown_class(self): pass + def test_0_update_api_roles(self): + headers = { + "x-api-key": config.api_key, + "username": config.username, + } + + data = { + "username": "api", + "password": "admin", + "creator": "api", + "roles": [ + 'IT Operator', + 'byoc', + config.role_sd_real_time, + config.role_sd_async, + config.role_comfy_async, + config.role_comfy_real_time, + ], + } + + resp = self.api.create_user(headers=headers, data=data) + + assert resp.status_code == 201, resp.dumps() + assert resp.json()["statusCode"] == 201 + def test_1_one_api_async(self): headers = { "x-api-key": config.api_key, diff --git a/test/test_06_api_inference/test_71_one_api_real_time.py b/test/test_06_api_inference/test_71_one_api_real_time.py index 96e94005..eb5af6cc 100644 --- a/test/test_06_api_inference/test_71_one_api_real_time.py +++ b/test/test_06_api_inference/test_71_one_api_real_time.py @@ -22,6 +22,31 @@ class TestInferenceOneApiRealTimeE2E: def teardown_class(self): pass + def test_0_update_api_roles(self): + headers = { + "x-api-key": config.api_key, + "username": config.username, + } + + data = { + "username": "api", + "password": "admin", + "creator": "api", + "roles": [ + 'IT Operator', + 'byoc', + config.role_sd_real_time, + config.role_sd_async, + config.role_comfy_async, + config.role_comfy_real_time, + ], + } + + resp = self.api.create_user(headers=headers, data=data) + + assert resp.status_code == 201, resp.dumps() + assert resp.json()["statusCode"] == 201 + def test_1_one_api_real_time(self): headers = { "x-api-key": config.api_key, diff --git a/test/test_06_api_inference/test_72_one_api_lcm_15_async.py b/test/test_06_api_inference/test_72_one_api_lcm_15_async.py index 89a7c0fa..2572d929 100644 --- a/test/test_06_api_inference/test_72_one_api_lcm_15_async.py +++ b/test/test_06_api_inference/test_72_one_api_lcm_15_async.py @@ -22,6 +22,31 @@ class TestInferenceOneApiLcm15AsyncE2E: def teardown_class(self): pass + def test_0_update_api_roles(self): + headers = { + "x-api-key": config.api_key, + "username": config.username, + } + + data = { + "username": "api", + "password": "admin", + "creator": "api", + "roles": [ + 'IT Operator', + 'byoc', + config.role_sd_real_time, + config.role_sd_async, + config.role_comfy_async, + config.role_comfy_real_time, + ], + } + + resp = self.api.create_user(headers=headers, data=data) + + assert resp.status_code == 201, resp.dumps() + assert resp.json()["statusCode"] == 201 + def test_1_one_api_lcm_15_async(self): headers = { "x-api-key": config.api_key, diff --git a/test/test_06_api_inference/test_73_one_api_lcm_15_real_time.py b/test/test_06_api_inference/test_73_one_api_lcm_15_real_time.py index 6cdcbc4c..d501ed57 100644 --- a/test/test_06_api_inference/test_73_one_api_lcm_15_real_time.py +++ b/test/test_06_api_inference/test_73_one_api_lcm_15_real_time.py @@ -21,6 +21,31 @@ class TestInferenceOneApiLcm15RealTimeE2E: def teardown_class(self): pass + def test_0_update_api_roles(self): + headers = { + "x-api-key": config.api_key, + "username": config.username, + } + + data = { + "username": "api", + "password": "admin", + "creator": "api", + "roles": [ + 'IT Operator', + 'byoc', + config.role_sd_real_time, + config.role_sd_async, + config.role_comfy_async, + config.role_comfy_real_time, + ], + } + + resp = self.api.create_user(headers=headers, data=data) + + assert resp.status_code == 201, resp.dumps() + assert resp.json()["statusCode"] == 201 + def test_1_one_api_lcm_15_real_time(self): headers = { "x-api-key": config.api_key, diff --git a/test/test_06_api_inference/test_74_one_api_lcm_xl_async.py b/test/test_06_api_inference/test_74_one_api_lcm_xl_async.py index c87a7090..74a5802c 100644 --- a/test/test_06_api_inference/test_74_one_api_lcm_xl_async.py +++ b/test/test_06_api_inference/test_74_one_api_lcm_xl_async.py @@ -22,6 +22,31 @@ class TestInferenceOneApiLcmXlAsyncE2E: def teardown_class(self): pass + def test_0_update_api_roles(self): + headers = { + "x-api-key": config.api_key, + "username": config.username, + } + + data = { + "username": "api", + "password": "admin", + "creator": "api", + "roles": [ + 'IT Operator', + 'byoc', + config.role_sd_real_time, + config.role_sd_async, + config.role_comfy_async, + config.role_comfy_real_time, + ], + } + + resp = self.api.create_user(headers=headers, data=data) + + assert resp.status_code == 201, resp.dumps() + assert resp.json()["statusCode"] == 201 + def test_1_one_api_lcm_xl_async(self): headers = { "x-api-key": config.api_key, diff --git a/test/test_06_api_inference/test_75_one_api_lcm_xl_real_time.py b/test/test_06_api_inference/test_75_one_api_lcm_xl_real_time.py index 53177b5b..530766ec 100644 --- a/test/test_06_api_inference/test_75_one_api_lcm_xl_real_time.py +++ b/test/test_06_api_inference/test_75_one_api_lcm_xl_real_time.py @@ -21,6 +21,31 @@ class TestInferenceOneApiLcmXLRealTimeE2E: def teardown_class(self): pass + def test_0_update_api_roles(self): + headers = { + "x-api-key": config.api_key, + "username": config.username, + } + + data = { + "username": "api", + "password": "admin", + "creator": "api", + "roles": [ + 'IT Operator', + 'byoc', + config.role_sd_real_time, + config.role_sd_async, + config.role_comfy_async, + config.role_comfy_real_time, + ], + } + + resp = self.api.create_user(headers=headers, data=data) + + assert resp.status_code == 201, resp.dumps() + assert resp.json()["statusCode"] == 201 + def test_1_one_api_lcm_xl_real_time(self): headers = { "x-api-key": config.api_key, diff --git a/test/test_08_api_inference_re/test_10_re_async_cn_1.py b/test/test_08_api_inference_re/test_10_re_async_cn_1.py index 4907aa72..5408bbac 100644 --- a/test/test_08_api_inference_re/test_10_re_async_cn_1.py +++ b/test/test_08_api_inference_re/test_10_re_async_cn_1.py @@ -25,6 +25,31 @@ class TestTxt2ImgInferenceAsyncCn1E2E: def teardown_class(self): pass + def test_0_update_api_roles(self): + headers = { + "x-api-key": config.api_key, + "username": config.username, + } + + data = { + "username": "api", + "password": "admin", + "creator": "api", + "roles": [ + 'IT Operator', + 'byoc', + config.role_sd_real_time, + config.role_sd_async, + config.role_comfy_async, + config.role_comfy_real_time, + ], + } + + resp = self.api.create_user(headers=headers, data=data) + + assert resp.status_code == 201, resp.dumps() + assert resp.json()["statusCode"] == 201 + def test_1_txt2img_re_async_create(self): headers = { "x-api-key": config.api_key, diff --git a/test/test_08_api_inference_re/test_11_re_async_cn_2.py b/test/test_08_api_inference_re/test_11_re_async_cn_2.py index f37ac983..626a5b61 100644 --- a/test/test_08_api_inference_re/test_11_re_async_cn_2.py +++ b/test/test_08_api_inference_re/test_11_re_async_cn_2.py @@ -25,6 +25,31 @@ class TestTxt2ImgInferenceAsyncCn2E2E: def teardown_class(cls): pass + def test_0_update_api_roles(self): + headers = { + "x-api-key": config.api_key, + "username": config.username, + } + + data = { + "username": "api", + "password": "admin", + "creator": "api", + "roles": [ + 'IT Operator', + 'byoc', + config.role_sd_real_time, + config.role_sd_async, + config.role_comfy_async, + config.role_comfy_real_time, + ], + } + + resp = self.api.create_user(headers=headers, data=data) + + assert resp.status_code == 201, resp.dumps() + assert resp.json()["statusCode"] == 201 + def test_1_txt2img_re_async_create(self): headers = { "x-api-key": config.api_key, diff --git a/test/test_08_api_inference_re/test_12_re_async_cn_3.py b/test/test_08_api_inference_re/test_12_re_async_cn_3.py index 31657fb1..633f1c0c 100644 --- a/test/test_08_api_inference_re/test_12_re_async_cn_3.py +++ b/test/test_08_api_inference_re/test_12_re_async_cn_3.py @@ -25,6 +25,31 @@ class TestTxt2ImgInferenceAsyncCn3E2E: def teardown_class(cls): pass + def test_0_update_api_roles(self): + headers = { + "x-api-key": config.api_key, + "username": config.username, + } + + data = { + "username": "api", + "password": "admin", + "creator": "api", + "roles": [ + 'IT Operator', + 'byoc', + config.role_sd_real_time, + config.role_sd_async, + config.role_comfy_async, + config.role_comfy_real_time, + ], + } + + resp = self.api.create_user(headers=headers, data=data) + + assert resp.status_code == 201, resp.dumps() + assert resp.json()["statusCode"] == 201 + def test_1_txt2img_async_create(self): headers = { "x-api-key": config.api_key, diff --git a/test/test_08_api_inference_re/test_15_re_txt2img_reactor_async.py b/test/test_08_api_inference_re/test_15_re_txt2img_reactor_async.py index 676aecbd..aba4efa2 100644 --- a/test/test_08_api_inference_re/test_15_re_txt2img_reactor_async.py +++ b/test/test_08_api_inference_re/test_15_re_txt2img_reactor_async.py @@ -25,6 +25,31 @@ class TestTxt2ImgReReactorAsyncE2E: def teardown_class(self): pass + def test_0_update_api_roles(self): + headers = { + "x-api-key": config.api_key, + "username": config.username, + } + + data = { + "username": "api", + "password": "admin", + "creator": "api", + "roles": [ + 'IT Operator', + 'byoc', + config.role_sd_real_time, + config.role_sd_async, + config.role_comfy_async, + config.role_comfy_real_time, + ], + } + + resp = self.api.create_user(headers=headers, data=data) + + assert resp.status_code == 201, resp.dumps() + assert resp.json()["statusCode"] == 201 + def test_1_txt2img_re_reactor_async_create(self): headers = { "x-api-key": config.api_key, diff --git a/test/test_08_api_inference_re/test_20_re_txt2img_async.py b/test/test_08_api_inference_re/test_20_re_txt2img_async.py index 00eb1e5b..4ae6277c 100644 --- a/test/test_08_api_inference_re/test_20_re_txt2img_async.py +++ b/test/test_08_api_inference_re/test_20_re_txt2img_async.py @@ -25,6 +25,31 @@ class TestTxt2ImgInferenceAsyncE2E: def teardown_class(self): pass + def test_0_update_api_roles(self): + headers = { + "x-api-key": config.api_key, + "username": config.username, + } + + data = { + "username": "api", + "password": "admin", + "creator": "api", + "roles": [ + 'IT Operator', + 'byoc', + config.role_sd_real_time, + config.role_sd_async, + config.role_comfy_async, + config.role_comfy_real_time, + ], + } + + resp = self.api.create_user(headers=headers, data=data) + + assert resp.status_code == 201, resp.dumps() + assert resp.json()["statusCode"] == 201 + def test_1_txt2img_async_create(self): headers = { "x-api-key": config.api_key, diff --git a/test/test_08_api_inference_re/test_21_re_txt2img_real_time.py b/test/test_08_api_inference_re/test_21_re_txt2img_real_time.py index 5564577f..a9be8887 100644 --- a/test/test_08_api_inference_re/test_21_re_txt2img_real_time.py +++ b/test/test_08_api_inference_re/test_21_re_txt2img_real_time.py @@ -22,6 +22,31 @@ class TestTxt2ImgInferenceRealTimeE2E: def teardown_class(cls): pass + def test_0_update_api_roles(self): + headers = { + "x-api-key": config.api_key, + "username": config.username, + } + + data = { + "username": "api", + "password": "admin", + "creator": "api", + "roles": [ + 'IT Operator', + 'byoc', + config.role_sd_real_time, + config.role_sd_async, + config.role_comfy_async, + config.role_comfy_real_time, + ], + } + + resp = self.api.create_user(headers=headers, data=data) + + assert resp.status_code == 201, resp.dumps() + assert resp.json()["statusCode"] == 201 + def test_1_txt2img_real_time_create(self): headers = { "x-api-key": config.api_key, diff --git a/test/test_08_api_inference_re/test_22_re_xyz_checkpoint.py b/test/test_08_api_inference_re/test_22_re_xyz_checkpoint.py index bdbe61d8..dd703d0c 100644 --- a/test/test_08_api_inference_re/test_22_re_xyz_checkpoint.py +++ b/test/test_08_api_inference_re/test_22_re_xyz_checkpoint.py @@ -34,6 +34,31 @@ class TestXyzCheckpointE2E: if 'id' in inference_data: delete_inference_jobs([inference_data['id']]) + def test_0_update_api_roles(self): + headers = { + "x-api-key": config.api_key, + "username": config.username, + } + + data = { + "username": "api", + "password": "admin", + "creator": "api", + "roles": [ + 'IT Operator', + 'byoc', + config.role_sd_real_time, + config.role_sd_async, + config.role_comfy_async, + config.role_comfy_real_time, + ], + } + + resp = self.api.create_user(headers=headers, data=data) + + assert resp.status_code == 201, resp.dumps() + assert resp.json()["statusCode"] == 201 + @pytest.mark.skip(reason="not ready") def test_1_xyz_checkpoint_txt2img_job_create(self): diff --git a/test/test_08_api_inference_re/test_23_re_xyz_refiner_checkpoint.py b/test/test_08_api_inference_re/test_23_re_xyz_refiner_checkpoint.py index 4d0fc32d..a42178cc 100644 --- a/test/test_08_api_inference_re/test_23_re_xyz_refiner_checkpoint.py +++ b/test/test_08_api_inference_re/test_23_re_xyz_refiner_checkpoint.py @@ -34,6 +34,31 @@ class TestXyzRefinerCheckpointE2E: if 'id' in inference_data: delete_inference_jobs([inference_data['id']]) + def test_0_update_api_roles(self): + headers = { + "x-api-key": config.api_key, + "username": config.username, + } + + data = { + "username": "api", + "password": "admin", + "creator": "api", + "roles": [ + 'IT Operator', + 'byoc', + config.role_sd_real_time, + config.role_sd_async, + config.role_comfy_async, + config.role_comfy_real_time, + ], + } + + resp = self.api.create_user(headers=headers, data=data) + + assert resp.status_code == 201, resp.dumps() + assert resp.json()["statusCode"] == 201 + @pytest.mark.skip(reason="not ready") def test_1_xyz_refiner_checkpoint_txt2img_job_create(self): diff --git a/test/test_08_api_inference_re/test_24_re_xyz_vae_checkpoint.py b/test/test_08_api_inference_re/test_24_re_xyz_vae_checkpoint.py index 59414b84..c1015efa 100644 --- a/test/test_08_api_inference_re/test_24_re_xyz_vae_checkpoint.py +++ b/test/test_08_api_inference_re/test_24_re_xyz_vae_checkpoint.py @@ -34,6 +34,31 @@ class TestXyzVaeE2E: if 'id' in inference_data: delete_inference_jobs([inference_data['id']]) + def test_0_update_api_roles(self): + headers = { + "x-api-key": config.api_key, + "username": config.username, + } + + data = { + "username": "api", + "password": "admin", + "creator": "api", + "roles": [ + 'IT Operator', + 'byoc', + config.role_sd_real_time, + config.role_sd_async, + config.role_comfy_async, + config.role_comfy_real_time, + ], + } + + resp = self.api.create_user(headers=headers, data=data) + + assert resp.status_code == 201, resp.dumps() + assert resp.json()["statusCode"] == 201 + @pytest.mark.skip(reason="not ready") def test_1_xyz_vae_txt2img_job_create(self): diff --git a/test/test_08_api_inference_re/test_30_re_esi_async.py b/test/test_08_api_inference_re/test_30_re_esi_async.py index 5ffa3084..902c1107 100644 --- a/test/test_08_api_inference_re/test_30_re_esi_async.py +++ b/test/test_08_api_inference_re/test_30_re_esi_async.py @@ -25,6 +25,31 @@ class TestEsiInferenceAsyncE2E: def teardown_class(cls): pass + def test_0_update_api_roles(self): + headers = { + "x-api-key": config.api_key, + "username": config.username, + } + + data = { + "username": "api", + "password": "admin", + "creator": "api", + "roles": [ + 'IT Operator', + 'byoc', + config.role_sd_real_time, + config.role_sd_async, + config.role_comfy_async, + config.role_comfy_real_time, + ], + } + + resp = self.api.create_user(headers=headers, data=data) + + assert resp.status_code == 201, resp.dumps() + assert resp.json()["statusCode"] == 201 + def test_1_esi_async_create(self): headers = { "x-api-key": config.api_key, diff --git a/test/test_08_api_inference_re/test_30_re_one_api_lcm_xl_real_time.py b/test/test_08_api_inference_re/test_30_re_one_api_lcm_xl_real_time.py index 53177b5b..530766ec 100644 --- a/test/test_08_api_inference_re/test_30_re_one_api_lcm_xl_real_time.py +++ b/test/test_08_api_inference_re/test_30_re_one_api_lcm_xl_real_time.py @@ -21,6 +21,31 @@ class TestInferenceOneApiLcmXLRealTimeE2E: def teardown_class(self): pass + def test_0_update_api_roles(self): + headers = { + "x-api-key": config.api_key, + "username": config.username, + } + + data = { + "username": "api", + "password": "admin", + "creator": "api", + "roles": [ + 'IT Operator', + 'byoc', + config.role_sd_real_time, + config.role_sd_async, + config.role_comfy_async, + config.role_comfy_real_time, + ], + } + + resp = self.api.create_user(headers=headers, data=data) + + assert resp.status_code == 201, resp.dumps() + assert resp.json()["statusCode"] == 201 + def test_1_one_api_lcm_xl_real_time(self): headers = { "x-api-key": config.api_key, diff --git a/test/test_08_api_inference_re/test_31_re_esi_real_time.py b/test/test_08_api_inference_re/test_31_re_esi_real_time.py index 5fbc5a08..60e13ade 100644 --- a/test/test_08_api_inference_re/test_31_re_esi_real_time.py +++ b/test/test_08_api_inference_re/test_31_re_esi_real_time.py @@ -22,6 +22,31 @@ class TestEsiRealTimeE2E: def teardown_class(cls): pass + def test_0_update_api_roles(self): + headers = { + "x-api-key": config.api_key, + "username": config.username, + } + + data = { + "username": "api", + "password": "admin", + "creator": "api", + "roles": [ + 'IT Operator', + 'byoc', + config.role_sd_real_time, + config.role_sd_async, + config.role_comfy_async, + config.role_comfy_real_time, + ], + } + + resp = self.api.create_user(headers=headers, data=data) + + assert resp.status_code == 201, resp.dumps() + assert resp.json()["statusCode"] == 201 + def test_1_esi_real_time_create(self): headers = { "x-api-key": config.api_key, diff --git a/test/test_08_api_inference_re/test_40_re_img2img_async.py b/test/test_08_api_inference_re/test_40_re_img2img_async.py index 1947fe4d..27077b48 100644 --- a/test/test_08_api_inference_re/test_40_re_img2img_async.py +++ b/test/test_08_api_inference_re/test_40_re_img2img_async.py @@ -25,6 +25,31 @@ class TestImg2ImgInferenceAsyncE2E: def teardown_class(self): pass + def test_0_update_api_roles(self): + headers = { + "x-api-key": config.api_key, + "username": config.username, + } + + data = { + "username": "api", + "password": "admin", + "creator": "api", + "roles": [ + 'IT Operator', + 'byoc', + config.role_sd_real_time, + config.role_sd_async, + config.role_comfy_async, + config.role_comfy_real_time, + ], + } + + resp = self.api.create_user(headers=headers, data=data) + + assert resp.status_code == 201, resp.dumps() + assert resp.json()["statusCode"] == 201 + def test_1_img2img_async_create(self): headers = { "x-api-key": config.api_key, diff --git a/test/test_08_api_inference_re/test_41_re_img2img_real_time.py b/test/test_08_api_inference_re/test_41_re_img2img_real_time.py index 1a02253f..56a7874a 100644 --- a/test/test_08_api_inference_re/test_41_re_img2img_real_time.py +++ b/test/test_08_api_inference_re/test_41_re_img2img_real_time.py @@ -22,6 +22,31 @@ class TestImg2ImgInferenceRealTimeE2E: def teardown_class(self): pass + def test_0_update_api_roles(self): + headers = { + "x-api-key": config.api_key, + "username": config.username, + } + + data = { + "username": "api", + "password": "admin", + "creator": "api", + "roles": [ + 'IT Operator', + 'byoc', + config.role_sd_real_time, + config.role_sd_async, + config.role_comfy_async, + config.role_comfy_real_time, + ], + } + + resp = self.api.create_user(headers=headers, data=data) + + assert resp.status_code == 201, resp.dumps() + assert resp.json()["statusCode"] == 201 + def test_1_img2img_real_time_create(self): headers = { "x-api-key": config.api_key, diff --git a/test/test_08_api_inference_re/test_50_re_rembg_async.py b/test/test_08_api_inference_re/test_50_re_rembg_async.py index dac39218..0df9b986 100644 --- a/test/test_08_api_inference_re/test_50_re_rembg_async.py +++ b/test/test_08_api_inference_re/test_50_re_rembg_async.py @@ -25,6 +25,31 @@ class TestRembgInferenceAsyncE2E: def teardown_class(self): pass + def test_0_update_api_roles(self): + headers = { + "x-api-key": config.api_key, + "username": config.username, + } + + data = { + "username": "api", + "password": "admin", + "creator": "api", + "roles": [ + 'IT Operator', + 'byoc', + config.role_sd_real_time, + config.role_sd_async, + config.role_comfy_async, + config.role_comfy_real_time, + ], + } + + resp = self.api.create_user(headers=headers, data=data) + + assert resp.status_code == 201, resp.dumps() + assert resp.json()["statusCode"] == 201 + def test_1_rembg_async_create(self): headers = { "x-api-key": config.api_key, diff --git a/test/test_08_api_inference_re/test_51_re_rembg_real_time.py b/test/test_08_api_inference_re/test_51_re_rembg_real_time.py index 068bbd8e..d1b5709c 100644 --- a/test/test_08_api_inference_re/test_51_re_rembg_real_time.py +++ b/test/test_08_api_inference_re/test_51_re_rembg_real_time.py @@ -22,6 +22,31 @@ class TestRembgRealTimeE2E: def teardown_class(self): pass + def test_0_update_api_roles(self): + headers = { + "x-api-key": config.api_key, + "username": config.username, + } + + data = { + "username": "api", + "password": "admin", + "creator": "api", + "roles": [ + 'IT Operator', + 'byoc', + config.role_sd_real_time, + config.role_sd_async, + config.role_comfy_async, + config.role_comfy_real_time, + ], + } + + resp = self.api.create_user(headers=headers, data=data) + + assert resp.status_code == 201, resp.dumps() + assert resp.json()["statusCode"] == 201 + def test_1_rembg_real_time_create(self): headers = { "x-api-key": config.api_key, diff --git a/test/test_08_api_inference_re/test_60_re_tps_real_time.py b/test/test_08_api_inference_re/test_60_re_tps_real_time.py index 37764905..30fc5075 100644 --- a/test/test_08_api_inference_re/test_60_re_tps_real_time.py +++ b/test/test_08_api_inference_re/test_60_re_tps_real_time.py @@ -40,7 +40,32 @@ class TestTpsRealTimeE2E: def teardown_class(cls): pass - def test_0_clear_inferences_jobs(self): + def test_0_update_api_roles(self): + headers = { + "x-api-key": config.api_key, + "username": config.username, + } + + data = { + "username": "api", + "password": "admin", + "creator": "api", + "roles": [ + 'IT Operator', + 'byoc', + config.role_sd_real_time, + config.role_sd_async, + config.role_comfy_async, + config.role_comfy_real_time, + ], + } + + resp = self.api.create_user(headers=headers, data=data) + + assert resp.status_code == 201, resp.dumps() + assert resp.json()["statusCode"] == 201 + + def test_1_clear_inferences_jobs(self): headers = { "x-api-key": config.api_key, "username": config.username @@ -56,7 +81,7 @@ class TestTpsRealTimeE2E: } self.api.delete_inferences(data=data, headers=headers) - def test_1_start_real_time_tps(self): + def test_2_start_real_time_tps(self): ids = [] for i in range(20): diff --git a/test/test_08_api_inference_re/test_70_re_one_api_async.py b/test/test_08_api_inference_re/test_70_re_one_api_async.py index 8e41fd2d..5c846d42 100644 --- a/test/test_08_api_inference_re/test_70_re_one_api_async.py +++ b/test/test_08_api_inference_re/test_70_re_one_api_async.py @@ -23,6 +23,31 @@ class TestInferenceOneApiAsyncE2E: def teardown_class(self): pass + def test_0_update_api_roles(self): + headers = { + "x-api-key": config.api_key, + "username": config.username, + } + + data = { + "username": "api", + "password": "admin", + "creator": "api", + "roles": [ + 'IT Operator', + 'byoc', + config.role_sd_real_time, + config.role_sd_async, + config.role_comfy_async, + config.role_comfy_real_time, + ], + } + + resp = self.api.create_user(headers=headers, data=data) + + assert resp.status_code == 201, resp.dumps() + assert resp.json()["statusCode"] == 201 + def test_1_one_api_async(self): headers = { "x-api-key": config.api_key, diff --git a/test/test_08_api_inference_re/test_71_re_one_api_real_time.py b/test/test_08_api_inference_re/test_71_re_one_api_real_time.py index 12bffb63..77243d02 100644 --- a/test/test_08_api_inference_re/test_71_re_one_api_real_time.py +++ b/test/test_08_api_inference_re/test_71_re_one_api_real_time.py @@ -22,6 +22,31 @@ class TestInferenceOneApiRealTimeE2E: def teardown_class(self): pass + def test_0_update_api_roles(self): + headers = { + "x-api-key": config.api_key, + "username": config.username, + } + + data = { + "username": "api", + "password": "admin", + "creator": "api", + "roles": [ + 'IT Operator', + 'byoc', + config.role_sd_real_time, + config.role_sd_async, + config.role_comfy_async, + config.role_comfy_real_time, + ], + } + + resp = self.api.create_user(headers=headers, data=data) + + assert resp.status_code == 201, resp.dumps() + assert resp.json()["statusCode"] == 201 + def test_1_one_api_real_time(self): headers = { "x-api-key": config.api_key, diff --git a/test/test_08_api_inference_re/test_72_re_one_api_lcm_15_async.py b/test/test_08_api_inference_re/test_72_re_one_api_lcm_15_async.py index 89a7c0fa..2572d929 100644 --- a/test/test_08_api_inference_re/test_72_re_one_api_lcm_15_async.py +++ b/test/test_08_api_inference_re/test_72_re_one_api_lcm_15_async.py @@ -22,6 +22,31 @@ class TestInferenceOneApiLcm15AsyncE2E: def teardown_class(self): pass + def test_0_update_api_roles(self): + headers = { + "x-api-key": config.api_key, + "username": config.username, + } + + data = { + "username": "api", + "password": "admin", + "creator": "api", + "roles": [ + 'IT Operator', + 'byoc', + config.role_sd_real_time, + config.role_sd_async, + config.role_comfy_async, + config.role_comfy_real_time, + ], + } + + resp = self.api.create_user(headers=headers, data=data) + + assert resp.status_code == 201, resp.dumps() + assert resp.json()["statusCode"] == 201 + def test_1_one_api_lcm_15_async(self): headers = { "x-api-key": config.api_key, diff --git a/test/test_08_api_inference_re/test_73_re_one_api_lcm_15_real_time.py b/test/test_08_api_inference_re/test_73_re_one_api_lcm_15_real_time.py index 6cdcbc4c..d501ed57 100644 --- a/test/test_08_api_inference_re/test_73_re_one_api_lcm_15_real_time.py +++ b/test/test_08_api_inference_re/test_73_re_one_api_lcm_15_real_time.py @@ -21,6 +21,31 @@ class TestInferenceOneApiLcm15RealTimeE2E: def teardown_class(self): pass + def test_0_update_api_roles(self): + headers = { + "x-api-key": config.api_key, + "username": config.username, + } + + data = { + "username": "api", + "password": "admin", + "creator": "api", + "roles": [ + 'IT Operator', + 'byoc', + config.role_sd_real_time, + config.role_sd_async, + config.role_comfy_async, + config.role_comfy_real_time, + ], + } + + resp = self.api.create_user(headers=headers, data=data) + + assert resp.status_code == 201, resp.dumps() + assert resp.json()["statusCode"] == 201 + def test_1_one_api_lcm_15_real_time(self): headers = { "x-api-key": config.api_key, diff --git a/test/test_08_api_inference_re/test_74_re_one_api_lcm_xl_async.py b/test/test_08_api_inference_re/test_74_re_one_api_lcm_xl_async.py index c87a7090..74a5802c 100644 --- a/test/test_08_api_inference_re/test_74_re_one_api_lcm_xl_async.py +++ b/test/test_08_api_inference_re/test_74_re_one_api_lcm_xl_async.py @@ -22,6 +22,31 @@ class TestInferenceOneApiLcmXlAsyncE2E: def teardown_class(self): pass + def test_0_update_api_roles(self): + headers = { + "x-api-key": config.api_key, + "username": config.username, + } + + data = { + "username": "api", + "password": "admin", + "creator": "api", + "roles": [ + 'IT Operator', + 'byoc', + config.role_sd_real_time, + config.role_sd_async, + config.role_comfy_async, + config.role_comfy_real_time, + ], + } + + resp = self.api.create_user(headers=headers, data=data) + + assert resp.status_code == 201, resp.dumps() + assert resp.json()["statusCode"] == 201 + def test_1_one_api_lcm_xl_async(self): headers = { "x-api-key": config.api_key,