pulp_2_tests.tests.rpm.api_v2.test_broker

Location: Pulp 2 TestsTestspulp_2_tests.tests.rpm.api_v2.test_broker

Tests for Pulp’s “broker reconnect” feature.

Tests for #55:

Pulp offers a collection of behaviors known as “reconnect support” for the Pulp Broker. Here are the expected behaviors:

  • If you start a Pulp service that connects to the broker and the broker is not running or is not network accessible for some reason, the Pulp services will wait-and-retry. It has a backoff behavior, but the important part is that Pulp services don’t exit if they can’t connect due to availability, and when the availability problem is resolved, the Pulp services reconnect.
  • If you have a Pulp service connected to the broker and the broker shuts down, the Pulp services need the wait-and-retry as described above. Once the broker becomes available again the Pulp services should reconnect.

There are two scenarios to test here:

  • support for initially connecting to a broker, and
  • support for reconnecting to a broker that goes missing.

Both scenarios are executed by pulp_2_tests.tests.rpm.api_v2.test_broker.BrokerTestCase.

class pulp_2_tests.tests.rpm.api_v2.test_broker.BrokerTestCase(methodName='runTest')

Bases: unittest.case.TestCase

Test Pulp’s support for broker connections and reconnections.

health_check()

Execute step three of the test plan.

setUp()

Provide a server config and Pulp services to stop and start.

tearDown()

Ensure Pulp services and AMQP broker are running.

Stop all relevant services, then start them again. This approach is slow, but see when broker reconnect test fails, all following tests fail.

test_broker_connect()

Test Pulp’s support for initially connecting to a broker.

Do the following:

  1. Stop both the broker and several other services.
  2. Start the several other resources, wait, and start the broker.
  3. Test Pulp’s health. Create an RPM repository, sync it, add a distributor, publish it, and download an RPM.
test_broker_reconnect()

Test Pulp’s support for reconnecting to a broker that goes missing.

Do the following:

  1. Start both the broker and several other services.
  2. Stop the broker, wait, and start it again.
  3. Test Pulp’s health. Create an RPM repository, sync it, add a distributor, publish it, and download an RPM.

This test targets: