-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #135 from morisja/issue-134
Issue 134 ,123- Enhance CI, Use reentrant functions for service lookups
- Loading branch information
Showing
5 changed files
with
213 additions
and
53 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,3 @@ | ||
/target | ||
cobertura.xml | ||
vendor |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
#!/bin/bash -e | ||
|
||
# this script tests sample calls inside a container | ||
# nsncd has to be running outside, with suitable test data configured | ||
|
||
rc=0 | ||
|
||
# basic lookups | ||
getent passwd nsncdtest || rc=1 | ||
getent group nsncdtest || rc=1 | ||
|
||
# we expect all of these to succeed | ||
for i in $(seq 1 100); do | ||
getent services 65000 || rc=1 | ||
getent services 65000/tcp || rc=1 | ||
getent services 65000/udp || rc=1 | ||
getent services foo1/tcp || rc=1 | ||
getent services foo1/udp || rc=1 | ||
netgroup trusted-machines || rc=1 | ||
getent netgroup trusted-machines || rc=1 | ||
innetgr -h machine1 trusted-machines || rc=1 | ||
innetgr -u user1 trusted-machines || rc=1 | ||
innetgr -d domain1 trusted-machines || rc=1 | ||
innetgr -h machine1 -u user1 -d domain1 trusted-machines || rc=1 | ||
done | ||
|
||
exit ${rc} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
#!/bin/bash | ||
|
||
sudo debootstrap stable /stable-chroot http://deb.debian.org/debian/ | ||
sudo dpkg -i nsncd*.deb | ||
|
||
sdns="sudo systemd-nspawn --quiet --no-pager --bind-ro /var/run/nscd/socket:/var/run/nscd/socket -D /stable-chroot" | ||
|
||
# Install the tooling required for netgroup and innetgr | ||
# Ensure nsswitch knows to read files for netgroup | ||
${sdns} apt-get update | ||
${sdns} apt-get install ng-utils | ||
${sdns} sed '/netgroup/d' -i /etc/nsswitch.conf | ||
${sdns} sed '$ a netgroup: files' -i /etc/nsswitch.conf | ||
|
||
# Similar nsswitch config for the host system so nsncd can access our test data | ||
sudo sed '/netgroup/d' -i /etc/nsswitch.conf | ||
sudo sed '$ a netgroup: files' -i /etc/nsswitch.conf | ||
|
||
rc=0 | ||
|
||
sudo useradd nsncdtest | ||
echo -e "foo1\t65000/tcp" | sudo tee -a /etc/services | ||
echo -e "foo1\t65000/udp" | sudo tee -a /etc/services | ||
echo -e "trusted-machines (machine1,user1,domain1), (machine2,user2,domain2), (machine3,user3,domain3)\n" | sudo tee -a /etc/netgroup | ||
|
||
# copy in and execute tests inside the chroot | ||
sudo cp ci/test_nsncd.sh /stable-chroot/ | ||
sudo chmod a+x /stable-chroot/test_nsncd.sh | ||
${sdns} /test_nsncd.sh | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters