Skip to content

Testing

Enno G edited this page May 20, 2024 · 2 revisions

General

The Golang-client tests can be executed using:

make test

Adding the test data for explorative testing

Start a container that runs the Cobbler server on port 8081 on the host and execute the following commands:

touch /root/kernel /root/initrd /root/testfile
cobbler distro add --name=test --kernel=/root/kernel --initrd=/root/initrd
cobbler profile add --name=testprof --distro=test
cobbler system add --name=testsys --profile=testprof
cobbler repo add --name=testrepo
cobbler menu add --name=testmenu
cobbler image add --name=testimage
cobbler package add --name=testpackage
cobbler mgmtclass add --name=testmgmtclass
cobbler file add --name=testfile --path=/root/testfile --owner=root --group=root --mode="0644" --template=/etc/cobbler/dhcp.template

Creating new unit-tests

Default credentials are cobbler for both username and password.

To create new unit tests please use a combination of the following things:

  • ./scripts/generate-fixture-xml.sh <fixture name>
  • curl -XPOST -d '<XML content>' http://localhost:25151/ (inside the container)

Getting the initial login token

curl -XPOST -d '<methodCall><methodName>login</methodName><params><param><value><string>cobbler</string></value></param><param><value><string>cobbler</string></value></param></params></methodCall>' http://localhost:25151/
Clone this wiki locally