def test_deploy_logs(cli_runner, datafiles, responses):
"""Test deploy_logs() command for expected upload cases."""
os.chdir(str(datafiles))
- workspace_dir = os.path.join(str(datafiles), "workspace")
# Test successful upload
build_url = "https://jenkins.example.org/job/builder-check-poms/204"
"""Test _request_post_file."""
zip_file = "zip-test-files/test.zip"
- resp = {}
test_url = "http://connection.error.test"
exception = requests.exceptions.ConnectionError(test_url)
responses.add(responses.POST, test_url, body=exception)
with pytest.raises(requests.HTTPError) as excinfo:
- resp = deploy_sys._request_post_file(test_url, zip_file)
+ deploy_sys._request_post_file(test_url, zip_file)
assert "Could not connect to URL" in str(excinfo.value)
test_url = "http://invalid.url.test:8081"
exception = requests.exceptions.InvalidURL(test_url)
responses.add(responses.POST, test_url, body=exception)
with pytest.raises(requests.HTTPError) as excinfo:
- resp = deploy_sys._request_post_file(test_url, zip_file)
+ deploy_sys._request_post_file(test_url, zip_file)
assert "Invalid URL" in str(excinfo.value)
test_url = "http://missing.schema.test:8081"
exception = requests.exceptions.MissingSchema(test_url)
responses.add(responses.POST, test_url, body=exception)
with pytest.raises(requests.HTTPError) as excinfo:
- resp = deploy_sys._request_post_file(test_url, zip_file)
+ deploy_sys._request_post_file(test_url, zip_file)
assert "Not valid URL" in str(excinfo.value)
test_url = "http://repository.read.only:8081"
responses.add(responses.POST, test_url, body=None, status=400)
with pytest.raises(requests.HTTPError) as excinfo:
- resp = deploy_sys._request_post_file(test_url, zip_file)
+ deploy_sys._request_post_file(test_url, zip_file)
assert "Repository is read only" in str(excinfo.value)
test_url = "http://repository.not.found:8081"
responses.add(responses.POST, test_url, body=None, status=404)
with pytest.raises(requests.HTTPError) as excinfo:
- resp = deploy_sys._request_post_file(test_url, zip_file)
+ deploy_sys._request_post_file(test_url, zip_file)
assert "Did not find repository" in str(excinfo.value)
test_url = "http://other.upload.error:8081"
responses.add(responses.POST, test_url, body=None, status=500)
with pytest.raises(requests.HTTPError) as excinfo:
- resp = deploy_sys._request_post_file(test_url, zip_file)
+ deploy_sys._request_post_file(test_url, zip_file)
assert "Failed to upload to Nexus with status code" in str(excinfo.value)
param = {"r": (None, "testing")}
zip_file = "zip-test-files/test.zip"
- resp = {}
test_url = "http://connection.error.test"
exception = requests.exceptions.ConnectionError(test_url)
responses.add(responses.POST, test_url, body=exception)
with pytest.raises(requests.HTTPError) as excinfo:
- resp = deploy_sys._request_post_file(test_url, zip_file, param)
+ deploy_sys._request_post_file(test_url, zip_file, param)
assert "Could not connect to URL" in str(excinfo.value)
test_url = "http://invalid.url.test:8081"
exception = requests.exceptions.InvalidURL(test_url)
responses.add(responses.POST, test_url, body=exception)
with pytest.raises(requests.HTTPError) as excinfo:
- resp = deploy_sys._request_post_file(test_url, zip_file, param)
+ deploy_sys._request_post_file(test_url, zip_file, param)
assert "Invalid URL" in str(excinfo.value)
test_url = "http://missing.schema.test:8081"
exception = requests.exceptions.MissingSchema(test_url)
responses.add(responses.POST, test_url, body=exception)
with pytest.raises(requests.HTTPError) as excinfo:
- resp = deploy_sys._request_post_file(test_url, zip_file, param)
+ deploy_sys._request_post_file(test_url, zip_file, param)
assert "Not valid URL" in str(excinfo.value)
test_url = "http://repository.read.only:8081"
responses.add(responses.POST, test_url, body=None, status=400)
with pytest.raises(requests.HTTPError) as excinfo:
- resp = deploy_sys._request_post_file(test_url, zip_file, param)
+ deploy_sys._request_post_file(test_url, zip_file, param)
assert "Repository is read only" in str(excinfo.value)
test_url = "http://repository.not.found:8081"
responses.add(responses.POST, test_url, body=None, status=404)
with pytest.raises(requests.HTTPError) as excinfo:
- resp = deploy_sys._request_post_file(test_url, zip_file, param)
+ deploy_sys._request_post_file(test_url, zip_file, param)
assert "Did not find repository" in str(excinfo.value)
test_url = "http://other.upload.error:8081"
responses.add(responses.POST, test_url, body=None, status=500)
with pytest.raises(requests.HTTPError) as excinfo:
- resp = deploy_sys._request_post_file(test_url, zip_file, param)
+ deploy_sys._request_post_file(test_url, zip_file, param)
assert "Failed to upload to Nexus with status code" in str(excinfo.value)
artifact_id = "ArtId2"
version = "1.2.7"
packaging = "tar.xz"
- classified = None
-
- resp = {}
test_url = "http://all.ok.upload:8081"
responses.add(responses.POST, "{}/{}".format(test_url, common_urlpart), body=None, status=201)
- resp = deploy_sys.upload_maven_file_to_nexus(
- test_url, nexus_repo_id, group_id, artifact_id, version, packaging, zip_file
- )
+ deploy_sys.upload_maven_file_to_nexus(test_url, nexus_repo_id, group_id, artifact_id, version, packaging, zip_file)
xml_other_error = """
<nexus-error><errors><error>
test_url = "http://something.went.wrong:8081"
responses.add(responses.POST, "{}/{}".format(test_url, common_urlpart), body=xml_other_error, status=405)
with pytest.raises(requests.HTTPError) as excinfo:
- resp = deploy_sys.upload_maven_file_to_nexus(
+ deploy_sys.upload_maven_file_to_nexus(
test_url, nexus_repo_id, group_id, artifact_id, version, packaging, zip_file
)
assert "Something went wrong" in str(excinfo.value)
def test_tag_class_manual_version_regexp_str_from_file_valid(self, datafiles):
org = "onap"
test_regexp_from_file = os.path.join(str(datafiles), "releasedockerhub_good_regexp")
- repo_from_file = False
rdh.initialize(org, test_regexp_from_file)
assert rdh.validate_regexp() == True
assert rdh.VERSION_REGEXP == "^\d+.\d+"
def test_tag_class_manual_version_regexp_str_from_file_invalid(self, datafiles):
org = "onap"
test_regexp_from_file = os.path.join(str(datafiles), "releasedockerhub_bad_regexp")
- repo_from_file = False
rdh.initialize(org, test_regexp_from_file)
assert rdh.validate_regexp() == False
assert rdh.VERSION_REGEXP == "["
# Verify that 90 timeout's on any stage failes.
self.nbr_exc.pull = 90
- with pytest.raises(requests.HTTPError) as excinfo:
+ with pytest.raises(requests.HTTPError):
test_proj.docker_pull_tag_push()
self.counter.pull = self.counter.tag = self.counter.push = self.counter.cleanup = 0
self.nbr_exc.pull = 0
self.nbr_exc.tag = 90
- with pytest.raises(requests.HTTPError) as excinfo:
+ with pytest.raises(requests.HTTPError):
test_proj.docker_pull_tag_push()
self.counter.pull = self.counter.tag = self.counter.push = self.counter.cleanup = 0
self.nbr_exc.pull = self.nbr_exc.tag = 0
self.nbr_exc.push = 90
- with pytest.raises(requests.HTTPError) as excinfo:
+ with pytest.raises(requests.HTTPError):
test_proj.docker_pull_tag_push()
self.counter.pull = self.counter.tag = self.counter.push = self.counter.cleanup = 0
self.nbr_exc.pull = self.nbr_exc.tag = self.nbr_exc.push = 0
self.nbr_exc.cleanup = 90
- with pytest.raises(requests.HTTPError) as excinfo:
+ with pytest.raises(requests.HTTPError):
test_proj.docker_pull_tag_push()
# Verify 89 timeouts and the 90 is ok per stage