Skip to content

Commit

Permalink
Remove obsoleted tests.
Browse files Browse the repository at this point in the history
Update Dockerfile to Fedora 39

In clear cache check if directory really exists

Signed-off-by: Petr "Stone" Hracek <phracek@redhat.com>
  • Loading branch information
phracek committed Sep 16, 2024
1 parent 5f1b54a commit 87439af
Show file tree
Hide file tree
Showing 5 changed files with 5 additions and 32 deletions.
2 changes: 1 addition & 1 deletion Dockerfile.generator
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM quay.io/fedora/fedora:36
FROM quay.io/fedora/fedora:39
ENV CWT_DIR=/tmp/container-workflow-tool
RUN dnf install -y go-md2man \
make git python3-PyYAML \
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile.tests
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM quay.io/fedora/fedora:36
FROM quay.io/fedora/fedora:39

RUN dnf install -y ansible

Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ TEST_IMAGE=cwt-tests
GENERATOR_IMAGE=quay.io/rhscl/cwt-generator
UNAME=$(shell uname)
ifeq ($(UNAME),Darwin)
PODMAN := /usr/local/bin/docker
PODMAN := /opt/podman/bin/podman
else
PODMAN := /usr/bin/podman
endif
Expand Down
3 changes: 2 additions & 1 deletion container_workflow_tool/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -425,7 +425,8 @@ def clear_cache(self):
self.logger.info("Removing cached data and git storage.")
# Clear ondisk storage for git and the brew cache
tmp = self._get_tmp_workdir(setup_dir=False)
shutil.rmtree(tmp, ignore_errors=True)
if tmp is not None and os.path.isdir(tmp):
shutil.rmtree(tmp, ignore_errors=True)
# If the working directory has been set by the user, recreate it
if self.tmp_workdir:
os.makedirs(tmp)
Expand Down
28 changes: 0 additions & 28 deletions tests/test_distgit.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,14 +66,7 @@ def test_distgit_merge_changes(self):
self.ir.conf["from_tag"] = "test"
tmp = Path(self.ir._get_tmp_workdir())
self.ir.dist_git_merge_changes()
dpath = tmp / self.component / 'Dockerfile'
assert os.path.isfile(dpath)
assert not (tmp / self.component / "test" / "test-openshift.yaml").exists()
tag_found = False
with open(dpath) as f:
if ":test" in f.read():
tag_found = True
assert tag_found
shutil.rmtree(tmp / self.component)

@pytest.mark.distgit
Expand All @@ -86,25 +79,4 @@ def test_distgit_merge_changes_openshift_yaml(self):
tmp = Path(self.ir._get_tmp_workdir())
self.ir.distgit._clone_downstream(self.component, "main")
self.ir.dist_git_merge_changes()
dpath = tmp / self.component / 'Dockerfile'
assert os.path.isfile(dpath)
tag_found = False
with open(dpath) as f:
if ":test" in f.read():
tag_found = True
assert tag_found
shutil.rmtree(tmp / self.component)

@pytest.mark.distgit
def test_tag_dockerfile(self):
tmp = Path(self.ir._get_tmp_workdir())
self.ir.conf["from_tag"] = "test"
self.ir.dist_git_merge_changes()
cpath = tmp / self.component
dpath = cpath / 'Dockerfile'
found_tag = False
with open(dpath) as f:
if ":test" in f.read():
found_tag = True
assert found_tag
shutil.rmtree(tmp / self.component)

0 comments on commit 87439af

Please sign in to comment.