Skip to content

Commit

Permalink
Test adding indices and pins using ssh
Browse files Browse the repository at this point in the history
  • Loading branch information
dalybrown committed Feb 22, 2024
1 parent a2e5a5d commit 35203d5
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 0 deletions.
26 changes: 26 additions & 0 deletions testsuite/tests/ssh/test.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
from drivers.alr import init_local_crate, run_alr
import os, subprocess

HOST = "github.com"
INDEX = "[email protected]:alire-project/test-index.git"
KNOWN_HOSTS_DIRECTORY = "~/.ssh"

# Test setup.
os.makedirs(KNOWN_HOSTS_DIRECTORY, exist_ok=True)
with open(KNOWN_HOSTS_DIRECTORY + "/known_hosts", "a+") as known_hosts:
if HOST not in known_hosts.read():
host_key = subprocess.run(["ssh-keyscan", HOST], capture_output=True).stdout
known_hosts.write(f"{host_key}\n")
init_local_crate()

# Ensure we can add an index using ssh.
run_alr("index", "--name", "test", "--add", INDEX, complain_on_error=True)
run_alr("index", "--check", complain_on_error=True)

# Ensure we can pin a crate using ssh.
run_alr("with", "libhello", "--use", "[email protected]:alire-project/libhello.git")

# Test teardown.
run_alr("index", "--del", "test", complain_on_error=True)

print("SUCCESS")
3 changes: 3 additions & 0 deletions testsuite/tests/ssh/test.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
driver: python-script
indexes:
compiler_only_index: {}

0 comments on commit 35203d5

Please sign in to comment.