tests: add static executor tests
This commit is contained in:
		
							parent
							
								
									e3a6e08e40
								
							
						
					
					
						commit
						83440e3f88
					
				
					 3 changed files with 29 additions and 1 deletions
				
			
		| 
						 | 
				
			
			@ -5,3 +5,4 @@ test_suite('ifupdown-ng')
 | 
			
		|||
atf_test_program{name='link_test'}
 | 
			
		||||
atf_test_program{name='ipv6-ra_test'}
 | 
			
		||||
atf_test_program{name='dhcp_test'}
 | 
			
		||||
atf_test_program{name='static_test'}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
							
								
								
									
										27
									
								
								tests/linux/static_test
									
										
									
									
									
										Executable file
									
								
							
							
						
						
									
										27
									
								
								tests/linux/static_test
									
										
									
									
									
										Executable file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,27 @@
 | 
			
		|||
#!/usr/bin/env atf-sh
 | 
			
		||||
 | 
			
		||||
. $(atf_get_srcdir)/../test_env.sh
 | 
			
		||||
EXECUTOR="$(atf_get_srcdir)/../../executor-scripts/linux/static"
 | 
			
		||||
FIXTURES="$(atf_get_srcdir)/../fixtures"
 | 
			
		||||
 | 
			
		||||
tests_init up down
 | 
			
		||||
 | 
			
		||||
up_body() {
 | 
			
		||||
	export IFACE=eth0 PHASE=up MOCK=echo INTERFACES_FILE="$FIXTURES/static-eth0.interfaces"
 | 
			
		||||
	atf_check -s exit:0 \
 | 
			
		||||
		-o match:'addr add 203.0.113.2/24 dev eth0' \
 | 
			
		||||
		-o match:'addr add 2001:db8:1000:2::2/64 dev eth0' \
 | 
			
		||||
		-o match:'route add default via 203.0.113.1' \
 | 
			
		||||
		-o match:'route add default via 2001:db8:1000:2::1' \
 | 
			
		||||
		${EXECUTOR}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
down_body() {
 | 
			
		||||
	export IFACE=eth0 PHASE=down MOCK=echo INTERFACES_FILE="$FIXTURES/static-eth0.interfaces"
 | 
			
		||||
	atf_check -s exit:0 \
 | 
			
		||||
		-o match:'addr del 203.0.113.2/24 dev eth0' \
 | 
			
		||||
		-o match:'addr del 2001:db8:1000:2::2/64 dev eth0' \
 | 
			
		||||
		-o match:'route del default via 203.0.113.1' \
 | 
			
		||||
		-o match:'route del default via 2001:db8:1000:2::1' \
 | 
			
		||||
		${EXECUTOR}
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			@ -1,4 +1,4 @@
 | 
			
		|||
PATH="$(atf_get_srcdir)/..:$PATH"
 | 
			
		||||
PATH="$(atf_get_srcdir)/..:$(atf_get_srcdir)/../..:$PATH"
 | 
			
		||||
FIXTURES="$(atf_get_srcdir)/fixtures"
 | 
			
		||||
EXECUTORS="$(atf_get_srcdir)/executors"
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue