Merge ~teknoraver/snappy-hwe-snaps/+git/captive-redirect:master into ~snappy-hwe-team/snappy-hwe-snaps/+git/captive-redirect:master

Proposed by Matteo Croce
Status: Merged
Approved by: Simon Fels
Approved revision: 2a81053a2481d06edd6301737558e119ae00b662
Merged at revision: 46a1843cad06c983b3dda1d0a51570168c985219
Proposed branch: ~teknoraver/snappy-hwe-snaps/+git/captive-redirect:master
Merge into: ~snappy-hwe-team/snappy-hwe-snaps/+git/captive-redirect:master
Diff against target: 36 lines (+30/-0)
1 file modified
tests/main/redirect-test/task.yaml (+30/-0)
Reviewer Review Type Date Requested Status
Simon Fels Approve
System Enablement Bot continuous-integration Approve
Review via email: mp+317755@code.launchpad.net

Description of the change

Full redirection spread test

To post a comment you must log in.
Revision history for this message
Simon Fels (morphis) wrote :

One minor comment, others LGTM.

Great work!

review: Needs Fixing
Revision history for this message
System Enablement Bot (system-enablement-ci-bot) wrote :
review: Approve (continuous-integration)
Revision history for this message
System Enablement Bot (system-enablement-ci-bot) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
System Enablement Bot (system-enablement-ci-bot) wrote :
review: Approve (continuous-integration)
Revision history for this message
Simon Fels (morphis) wrote :

LGTM

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1diff --git a/tests/main/redirect-test/task.yaml b/tests/main/redirect-test/task.yaml
2new file mode 100644
3index 0000000..d80006c
4--- /dev/null
5+++ b/tests/main/redirect-test/task.yaml
6@@ -0,0 +1,30 @@
7+summary: Verify that the redirect is effective
8+
9+restore: |
10+ ip link del veth0
11+ ip netns del client
12+
13+execute: |
14+ # Create a network namespace and a couple of virtual interfaces
15+ ip netns add client
16+ ip link add veth0 type veth peer name veth1
17+ ip link set veth1 netns client
18+
19+ # Setup network addresses and routes
20+ ifconfig veth0 192.168.123.1
21+ ip netns exec client ifconfig veth1 192.168.123.20
22+ ip netns exec client route add default gw 192.168.123.1
23+ iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE
24+ echo 1 >/proc/sys/net/ipv4/ip_forward
25+
26+ # Enable the redirect on the virtual interface
27+ /snap/bin/captive-redirect.config set active=true port=3000 interfaces=veth0
28+
29+ # Install wget
30+ snap install demo-wget
31+
32+ # Start a fake webserver on port 3000
33+ echo -e 'HTTP/1.1 200 OK\r\n\r\ncaptive-redirect' |nc -lp 3000 &
34+
35+ # try to download a webpage
36+ ip netns exec client /snap/demo-wget/current/usr/bin/wget -qO- http://www.example.com/ |grep captive-redirect

Subscribers

People subscribed via source and target branches

to all changes: