You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
27 lines
651 B
Python
27 lines
651 B
Python
import pytest
|
|
import re
|
|
|
|
|
|
@pytest.mark.parametrize('name,pattern', [
|
|
('GOROOT', '^/opt/go/1.21.1$'),
|
|
('GOPATH', '^/root/workspace-go$'),
|
|
('PATH', '^(.+:)?/opt/go/1.21.1/bin(:.+)?$'),
|
|
('PATH', '^(.+:)?/root/workspace-go/bin(:.+)?$')
|
|
])
|
|
def test_go_env(host, name, pattern):
|
|
cmd = host.run('. /etc/profile && printf $' + name)
|
|
assert re.search(pattern, cmd.stdout)
|
|
|
|
|
|
def test_go(host):
|
|
cmd = host.run('. /etc/profile && go version')
|
|
assert cmd.rc == 0
|
|
|
|
|
|
@pytest.mark.parametrize('command', [
|
|
'gofmt'
|
|
])
|
|
def test_go_tools(host, command):
|
|
cmd = host.run('. /etc/profile && which ' + command)
|
|
assert cmd.rc == 0
|