# sync local dir
self.fs.sync(from_path=cluster_uuid)
- # helm repo update
- command = "env KUBECONFIG={} {} repo update".format(
- paths["kube_config"], self._helm_command
- )
- self.log.debug("updating repo: {}".format(command))
- await self._local_async_exec(
- command=command, raise_exception_on_error=False, env=env
- )
-
# helm repo add name url
command = ("env KUBECONFIG={} {} repo add {} {}").format(
paths["kube_config"], self._helm_command, name, url
command=command, raise_exception_on_error=True, env=env
)
+ # helm repo update
+ command = "env KUBECONFIG={} {} repo update".format(
+ paths["kube_config"], self._helm_command
+ )
+ self.log.debug("updating repo: {}".format(command))
+ await self._local_async_exec(
+ command=command, raise_exception_on_error=False, env=env
+ )
+
# sync fs
self.fs.reverse_sync(from_path=cluster_uuid)
async def test_repo_add(self):
repo_name = "bitnami"
repo_url = "https://charts.bitnami.com/bitnami"
- self.helm_conn._local_async_exec = asynctest.CoroutineMock(return_value=("", 0))
+ self.helm_conn._local_async_exec = asynctest.CoroutineMock(return_value=(0, ""))
await self.helm_conn.repo_add(self.cluster_uuid, repo_name, repo_url)
call0_kargs = calls[0][1]
self.assertEqual(
call0_kargs.get("command"),
- repo_update_command,
- "Invalid repo update command: {}".format(call0_kargs.get("command")),
+ repo_add_command,
+ "Invalid repo add command: {}".format(call0_kargs.get("command")),
)
self.assertEqual(
call0_kargs.get("env"),
self.env,
- "Invalid env for update command: {}".format(call0_kargs.get("env")),
+ "Invalid env for add command: {}".format(call0_kargs.get("env")),
)
call1_kargs = calls[1][1]
self.assertEqual(
call1_kargs.get("command"),
- repo_add_command,
- "Invalid repo add command: {}".format(call1_kargs.get("command")),
+ repo_update_command,
+ "Invalid repo update command: {}".format(call1_kargs.get("command")),
)
self.assertEqual(
call1_kargs.get("env"),
self.env,
- "Invalid env for add command: {}".format(call1_kargs.get("env")),
+ "Invalid env for update command: {}".format(call1_kargs.get("env")),
)
@asynctest.fail_on(active_handles=True)
# pass fake kubectl and helm commands to make sure it does not call actual commands
K8sHelmConnector._check_file_exists = asynctest.Mock(return_value=True)
K8sHelmConnector._local_async_exec = asynctest.CoroutineMock(
- return_value=("", 0)
+ return_value=(0, "")
)
cluster_dir = self.fs.path + self.cluster_id
self.kube_config = self.fs.path + self.cluster_id + "/.kube/config"
call0_kargs = calls[0][1]
self.assertEqual(
call0_kargs.get("command"),
- repo_update_command,
- "Invalid repo update command: {}".format(call0_kargs.get("command")),
+ repo_add_command,
+ "Invalid repo add command: {}".format(call0_kargs.get("command")),
)
self.assertEqual(
call0_kargs.get("env"),
self.env,
- "Invalid env for update command: {}".format(call0_kargs.get("env")),
+ "Invalid env for add command: {}".format(call0_kargs.get("env")),
)
call1_kargs = calls[1][1]
self.assertEqual(
call1_kargs.get("command"),
- repo_add_command,
- "Invalid repo add command: {}".format(call1_kargs.get("command")),
+ repo_update_command,
+ "Invalid repo update command: {}".format(call1_kargs.get("command")),
)
self.assertEqual(
call1_kargs.get("env"),
self.env,
- "Invalid env for add command: {}".format(call1_kargs.get("env")),
+ "Invalid env for update command: {}".format(call1_kargs.get("env")),
)
@asynctest.fail_on(active_handles=True)