Skip to content

Commit

Permalink
Add missing dependencies to dev version of Dockerfile
Browse files Browse the repository at this point in the history
  • Loading branch information
asmorodskyi committed May 31, 2024
1 parent 11d1e31 commit 494b1b7
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 22 deletions.
4 changes: 2 additions & 2 deletions containers/Dockerfile_dev
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
FROM registry.suse.com/bci/python:3.11

COPY requirements.txt /pcw/
COPY requirements.txt requirements_k8s.txt requirements_test.txt /pcw/
RUN source /etc/os-release && zypper addrepo -G -cf "https://download.opensuse.org/repositories/SUSE:/CA/$VERSION_ID/SUSE:CA.repo" && \
zypper -n in ca-certificates-suse gcc libffi-devel && \
pip install --no-cache-dir wheel && pip install --no-cache-dir -r /pcw/requirements.txt && zypper clean && rm -rf /var/cache
pip install --no-cache-dir wheel && pip install --no-cache-dir -r /pcw/requirements_test.txt && zypper clean && rm -rf /var/cache

ENV PYTHONDONTWRITEBYTECODE=1 PYTHONUNBUFFERED=1 UWSGI_WSGI_FILE=/pcw/webui/wsgi.py UWSGI_MASTER=1
ENV UWSGI_HTTP_AUTO_CHUNKED=1 UWSGI_HTTP_KEEPALIVE=1 UWSGI_LAZY_APPS=1 UWSGI_WSGI_ENV_BEHAVIOR=holy
Expand Down
29 changes: 9 additions & 20 deletions tests/test_ec2.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ def mocked_client():
mocked_ec2_resource.Vpc = mocked_vpc
mocked_ec2_resource.meta = mocked_meta
mocked_ec2_resource.VpcPeeringConnection = lambda id: MockedVpcPeeringConnection()
mocked_ec2_resource.instances = MockedCollectionWithAllMethod()
mocked_meta.client = mocked_client
# don't mix up this with EC2.delete_vpc . this one is boto3 side of the call
mocked_client.delete_vpc = mocked_boto3_delete_vpc
Expand Down Expand Up @@ -83,22 +84,6 @@ def mock_local_get_feature_property(feature: str, property: str, namespace: str
monkeypatch.setattr('smtplib.SMTP', lambda arg1, arg2: MockedSMTP())
return EC2('fake')

class MockedInstances:
is_empty = False

def __init__(self, subnet=True) -> None:
self.subnet = subnet

def all(self):
if self.subnet:
if MockedInstances.is_empty:
return []
else:
return ['subnet']
else:
return 5



class MockedEC2Client():
response = {}
Expand Down Expand Up @@ -143,9 +128,6 @@ class MockedEC2Client():
}
]}

def __init__(self, region):
self.instances = MockedInstances(subnet=False)

ec2_snapshots = {snapshotid_to_delete: 'snapshot', snapshotid_i_have_ami: 'snapshot'}

def describe_images(self, *args, **kwargs):
Expand Down Expand Up @@ -203,7 +185,14 @@ def ehlo(self):
def sendmail(self, sender_email, receiver_email, mimetext):
MockedSMTP.mimetext = mimetext

class MockedInstances:
is_empty = False

def all(self):
if MockedInstances.is_empty:
return []
else:
return ['subnet']

class MockedInterface:
delete_called = False
Expand Down Expand Up @@ -519,4 +508,4 @@ def mocked_get_boolean(config_path, field=None):
assert called_stack == ['cleanup_images', 'cleanup_snapshots', 'cleanup_volumes', 'cleanup_vpcs']

def test_list_all_instances(ec2_patch):
assert ec2_patch.count_all_instances() == 5
assert ec2_patch.count_all_instances() == 1

0 comments on commit 494b1b7

Please sign in to comment.