Skip to content

Commit 68e560f

Browse files
Merge pull request #2745 from threefoldtech/development_fix_vdc_dashboard_tests
Add hours attribute to deploy VDC
2 parents 9cc1020 + dbf0e8f commit 68e560f

File tree

2 files changed

+13
-7
lines changed

2 files changed

+13
-7
lines changed

tests/sals/automated_chatflows/test_vdc_dashboard.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,11 @@ def setUpClass(cls):
1919
cls._import_wallet("demos_wallet")
2020
no_deployment = "single"
2121
cls.flavor = "platinum"
22-
cls.kube_config = cls.deploy_vdc()
22+
23+
if cls.no_deployment == "single":
24+
cls.kube_config = cls.deploy_vdc()
25+
else:
26+
cls.kube_config = cls.deploy_vdc(hours=2)
2327

2428
if not cls.kube_config:
2529
raise RuntimeError("VDC is not deployed")

tests/sals/vdc/vdc_base.py

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -66,22 +66,24 @@ def _start_threebot_server(cls):
6666
cls.server.start()
6767

6868
@classmethod
69-
def deploy_vdc(cls):
69+
def deploy_vdc(cls, hours=1):
7070
cls.vdc_name = cls.random_name().lower()
7171
cls.password = cls.random_string()
7272
cls.vdc = j.sals.vdc.new(cls.vdc_name, cls.tname, cls.flavor)
7373

74-
cls.info("Transfer needed TFT to deploy vdc for an hour to the provisioning wallet.")
74+
cls.info(f"Transfer needed TFT to deploy vdc for {hours} hour/s to the provisioning wallet.")
7575
cls.vdc_price = j.tools.zos.consumption.calculate_vdc_price(cls.flavor)
76-
needed_tft = (
77-
float(cls.vdc_price) / 24 / 30 + 2 * TRANSACTION_FEES
78-
) # 2 transaction fees for creating the pool and extend it
76+
extension_fees = TRANSACTION_FEES if hours > 1 else 0
77+
needed_tft = hours * (float(cls.vdc_price) / 24 / 30) + 2 * TRANSACTION_FEES + extension_fees
78+
# 2 transaction fees for creating the pool and extend it
7979
cls.vdc.transfer_to_provisioning_wallet(needed_tft, "test_wallet")
8080

81-
cls.info("Deploy VDC.")
81+
cls.info(f"Deploy VDC for {hours} hours.")
8282
cls.deployer = cls.vdc.get_deployer(password=cls.password)
8383
minio_ak = cls.random_name().lower()
8484
minio_sk = cls.random_string()
8585
cls.timestamp_now = j.data.time.get().utcnow().timestamp
8686
kube_config = cls.deployer.deploy_vdc(minio_ak, minio_sk)
87+
if hours > 1:
88+
cls.deployer.renew_plan(duration=hours / 24)
8789
return kube_config

0 commit comments

Comments
 (0)