Skip to content

Commit

Permalink
[Ci] Upgrade python 2 to python 3 (#145)
Browse files Browse the repository at this point in the history
[Ci] Upgrade python 2 to python 3
Fix unit test failure
  • Loading branch information
xumia authored Jun 28, 2023
1 parent 1c50caa commit 6b242a3
Show file tree
Hide file tree
Showing 9 changed files with 136 additions and 139 deletions.
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ RUN apt-get update \
libzmq5-dev

COPY debs /debs
RUN dpkg -i /debs/*.deb
RUN dpkg -i /debs/*.deb || apt-get --fix-broken -y install
RUN rm -fr /debs

COPY supervisor/supervisor.conf /etc/supervisor/conf.d/
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile.build
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ RUN apt-get update \
pkg-config

COPY debs /debs
RUN dpkg -i /debs/*.deb
RUN dpkg -i /debs/*.deb || apt-get --fix-broken -y install
RUN rm -fr /debs

#RUN export VERSION=0.9.3 \
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile.test
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ RUN apt-get update \
libzmq5-dev

COPY debs /debs
RUN dpkg -i /debs/*.deb
RUN dpkg -i /debs/*.deb || apt-get --fix-broken -y install
RUN rm -fr /debs

# Adjust redis configurations
Expand Down
8 changes: 1 addition & 7 deletions azurepipeline.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,6 @@ jobs:
- checkout: self
clean: true

# TODO: upgrade to python3
- task: UsePythonVersion@0
inputs:
versionSpec: '2.7'

- script: |
set -ex
./build.sh
Expand All @@ -40,8 +35,7 @@ jobs:
- script: |
set -ex
pip install requests
pip install redis
pip install -r test/requirements.txt
pip install -U pytest
cd test
pytest -vv
Expand Down
4 changes: 2 additions & 2 deletions copy.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
set -e

wget -O debs/libhiredis0.14_0.14.0-3~bpo9+1_amd64.deb 'https://sonic-build.azurewebsites.net/api/sonic/artifacts?branchName=master&platform=vs&target=target%2Fdebs%2Fbuster%2Flibhiredis0.14_0.14.0-3~bpo9%2B1_amd64.deb'
wget -O debs/libhiredis-dev_0.14.0-3~bpo9+1_amd64.deb 'https://sonic-build.azurewebsites.net/api/sonic/artifacts?branchName=master&platform=vs&target=target%2Fdebs%2Fbuster%2Flibhiredis-dev_0.14.0-3~bpo9%2B1_amd64.deb'
wget -O debs/libhiredis0.14_0.14.1-1_amd64.deb 'https://sonic-build.azurewebsites.net/api/sonic/artifacts?branchName=master&platform=vs&target=target%2Fdebs%2Fbuster%2Flibhiredis0.14_0.14.1-1_amd64.deb'
wget -O debs/libhiredis-dev_0.14.1-1_amd64.deb 'https://sonic-build.azurewebsites.net/api/sonic/artifacts?branchName=master&platform=vs&target=target%2Fdebs%2Fbuster%2Flibhiredis-dev_0.14.1-1_amd64.deb'
wget -O debs/libnl-3-200_3.5.0-1_amd64.deb 'https://sonic-build.azurewebsites.net/api/sonic/artifacts?branchName=master&platform=vs&target=target/debs/buster/libnl-3-200_3.5.0-1_amd64.deb'
wget -O debs/libnl-3-dev_3.5.0-1_amd64.deb 'https://sonic-build.azurewebsites.net/api/sonic/artifacts?branchName=master&platform=vs&target=target/debs/buster/libnl-3-dev_3.5.0-1_amd64.deb'
wget -O debs/libnl-genl-3-200_3.5.0-1_amd64.deb 'https://sonic-build.azurewebsites.net/api/sonic/artifacts?branchName=master&platform=vs&target=target/debs/buster/libnl-genl-3-200_3.5.0-1_amd64.deb'
Expand Down
4 changes: 2 additions & 2 deletions dependencies.conf
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
"debian": "buster",
"arch": "amd64",
"dependencies": [
"libhiredis0.14_0.14.0-3~bpo9+1",
"libhiredis-dev_0.14.0-3~bpo9+1",
"libhiredis0.14_0.14.1-1",
"libhiredis-dev_0.14.1-1",
"libnl-3-200_3.5.0-1",
"libnl-3-dev_3.5.0-1",
"libnl-genl-3-200_3.5.0-1",
Expand Down
12 changes: 6 additions & 6 deletions test/apitest.py
Original file line number Diff line number Diff line change
Expand Up @@ -248,9 +248,9 @@ def check_routes_exist_in_tun_tb(self, vnet_num_mapped, routes_arr):
for route in routes_arr:
route_table = self.db.hgetall(ROUTE_TUN_TB + ':' + VNET_NAME_PREF +str(vnet_num_mapped)+':'+route['ip_prefix'])
self.assertEqual(route_table, {
b'endpoint' : route['nexthop'],
b'mac_address' : route['mac_address'],
b'vni' : str(route['vnid'])
b'endpoint' : route['nexthop'].encode(),
b'mac_address' : route['mac_address'].encode(),
b'vni' : str(route['vnid']).encode()
})

def check_routes_dont_exist_in_tun_tb(self, vnet_num_mapped, routes_arr):
Expand All @@ -262,8 +262,8 @@ def check_routes_exist_in_loc_route_tb(self, vnet_num_mapped, routes_arr):
for route in routes_arr:
route_table = self.db.hgetall(LOCAL_ROUTE_TB + ':' + VNET_NAME_PREF +str(vnet_num_mapped)+':'+route['ip_prefix'])
self.assertEqual(route_table, {
b'nexthop' : route['nexthop'],
b'ifname' : route['ifname']
b'nexthop' : route['nexthop'].encode(),
b'ifname' : route['ifname'].encode()
})

def check_routes_dont_exist_in_loc_route_tb(self, vnet_num_mapped, routes_arr):
Expand Down Expand Up @@ -1186,7 +1186,7 @@ def test_vrf_routes_all_verbs(self):
def test_local_subnet_route_addition(self):
self.post_generic_vlan_and_deps()
local_route_table = self.db.hgetall(LOCAL_ROUTE_TB + ':' + VNET_NAME_PREF +str(1)+':10.1.1.0/24')
self.assertEqual(local_route_table, {b'ifname' : VLAN_NAME_PREF + '2'})
self.assertEqual(local_route_table, {b'ifname' : VLAN_NAME_PREF.encode() + b'2'})
r = self.delete_config_vlan(2)
self.assertEqual(r.status_code, 204)
local_route_table = self.db.hgetall(LOCAL_ROUTE_TB + ':' + VNET_NAME_PREF +str(1)+':10.1.1.0/24')
Expand Down
10 changes: 5 additions & 5 deletions test/restapi_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -250,9 +250,9 @@ def check_routes_exist_in_tun_tb(self, vnet_num_mapped, routes_arr):
for route in routes_arr:
route_table = self.db.hgetall(ROUTE_TUN_TB + ':' + VNET_NAME_PREF +str(vnet_num_mapped)+':'+route['ip_prefix'])
assert route_table == {
b'endpoint' : route['nexthop'],
b'mac_address' : route['mac_address'],
b'vni' : str(route['vnid'])
b'endpoint' : route['nexthop'].encode(),
b'mac_address' : route['mac_address'].encode(),
b'vni' : str(route['vnid']).encode()
}

def check_routes_dont_exist_in_tun_tb(self, vnet_num_mapped, routes_arr):
Expand All @@ -264,8 +264,8 @@ def check_routes_exist_in_loc_route_tb(self, vnet_num_mapped, routes_arr):
for route in routes_arr:
route_table = self.db.hgetall(LOCAL_ROUTE_TB + ':' + VNET_NAME_PREF +str(vnet_num_mapped)+':'+route['ip_prefix'])
assert route_table == {
b'nexthop' : route['nexthop'],
b'ifname' : route['ifname']
b'nexthop' : route['nexthop'].encode(),
b'ifname' : route['ifname'].encode()
}

def check_routes_dont_exist_in_loc_route_tb(self, vnet_num_mapped, routes_arr):
Expand Down
Loading

0 comments on commit 6b242a3

Please sign in to comment.