Project

Profile

Help

Refactor #940

closed

The Pulp tests load their configuration from a file instead of just configuring through the config module

Added by rbarlow over 9 years ago. Updated over 5 years ago.

Status:
CLOSED - CURRENTRELEASE
Priority:
Normal
Assignee:
Category:
-
Sprint/Milestone:
-
Start date:
Due date:
% Done:

100%

Estimated time:
Platform Release:
2.8.0
Groomed:
No
Sprint Candidate:
No
Tags:
Easy Fix, Pulp 2
Sprint:
May 2015
Quarter:

Description

A nice improvement would be to refactor the test suite to configure the test run by just modifying pulp.server.config rather than doing complicated double config loading as happens today. This is mostly necessary to make sure the tests use a different database than the developer's normal database, but there are a few other settings configured as well in test-override-pulp.conf.

I think this is probably easy to do and I was tempted to do it as part of #131, but I decided that it was a separate concern since #131 is already a large pull request in the making.

Actions #1

Updated by rbarlow over 9 years ago

  • Status changed from NEW to ASSIGNED
  • Assignee set to rbarlow
  • Sprint/Milestone set to 16
  • Platform Release set to master
  • Groomed set to No
  • Sprint Candidate set to No

Fixing this will solve the current build issue in https://github.com/pulp/pulp_rpm/pull/682 and I believe it will not take very long to complete. Therefore I am doing it now!

Added by rbarlow over 9 years ago

Revision a90fc5e0 | View on GitHub

Create the test config in code rather than a file.

This commit sets the test config in the test setup code, rather than importing the configuration from a test file. This is easier to edit, and also does not require the pulp.devel package to distribute a data file.

Furthermore, this commit also forbids tests to call pulp.server.config.config.set() or any variants thereof. Instead, it provides a new convenience mock function that makes it easy to patch particular settings during tests without altering the settings globally as was done before.

Many tests had to be fixed as a result of these changes, but now they are not altering global settings as they were doing before.

https://pulp.plan.io/issues/940

fixes #940

Added by rbarlow over 9 years ago

Revision a90fc5e0 | View on GitHub

Create the test config in code rather than a file.

This commit sets the test config in the test setup code, rather than importing the configuration from a test file. This is easier to edit, and also does not require the pulp.devel package to distribute a data file.

Furthermore, this commit also forbids tests to call pulp.server.config.config.set() or any variants thereof. Instead, it provides a new convenience mock function that makes it easy to patch particular settings during tests without altering the settings globally as was done before.

Many tests had to be fixed as a result of these changes, but now they are not altering global settings as they were doing before.

https://pulp.plan.io/issues/940

fixes #940

Actions #2

Updated by rbarlow over 9 years ago

  • Status changed from ASSIGNED to POST
Actions #3

Updated by rbarlow over 9 years ago

  • Status changed from POST to MODIFIED
  • % Done changed from 0 to 100

Added by rbarlow over 9 years ago

Revision 39da8a91 | View on GitHub

Initialize the DB connection in the test package.

Use the test package to start the database connection, rather than relying on test superclasses to do it. This way, only one database connection will happen during the unit tests rather than one per test class.

Additionally, mock all instances of alterations to the server config during testing.

https://pulp.plan.io/issues/131

re #131 re #940

Actions #4

Updated by rbarlow about 9 years ago

  • Platform Release changed from master to 2.8.0
Actions #5

Updated by dkliban@redhat.com almost 9 years ago

  • Status changed from MODIFIED to 5
Actions #6

Updated by rbarlow almost 9 years ago

  • Status changed from 5 to 6

Our tests are no longer allowed to start their own DB connections.

Actions #7

Updated by dkliban@redhat.com almost 9 years ago

  • Status changed from 6 to CLOSED - CURRENTRELEASE
Actions #9

Updated by bmbouter almost 7 years ago

  • Sprint set to May 2015
Actions #10

Updated by bmbouter almost 7 years ago

  • Sprint/Milestone deleted (16)
Actions #11

Updated by bmbouter over 5 years ago

  • Tags Pulp 2 added

Also available in: Atom PDF