TUN-5680: Adapt component tests for new service install based on token

This commit is contained in:
João Oliveirinha
2022-03-02 15:56:32 +00:00
parent 706523389c
commit 5431e0ca12
4 changed files with 81 additions and 14 deletions

View File

@@ -1,5 +1,7 @@
#!/usr/bin/env python
import copy
import json
import base64
from dataclasses import dataclass, InitVar
@@ -61,6 +63,23 @@ class NamedTunnelConfig(NamedTunnelBaseConfig):
def get_url(self):
return "https://" + self.ingress[0]['hostname']
def base_config(self):
config = self.full_config.copy()
# removes the tunnel reference
del(config["tunnel"])
del(config["credentials-file"])
return config
def get_token(self):
with open(self.credentials_file) as json_file:
creds = json.load(json_file)
token_dict = {"a": creds["AccountTag"], "t": creds["TunnelID"], "s": creds["TunnelSecret"]}
token_json_str = json.dumps(token_dict)
return base64.b64encode(token_json_str.encode('utf-8'))
@dataclass(frozen=True)
class ClassicTunnelBaseConfig(BaseConfig):