Project

Profile

Help

Refactor #940

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

Added by rbarlow over 5 years ago. Updated over 1 year 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.

Associated revisions

Revision a90fc5e0 View on GitHub
Added by rbarlow over 5 years ago

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

Revision a90fc5e0 View on GitHub
Added by rbarlow over 5 years ago

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

Revision 39da8a91 View on GitHub
Added by rbarlow over 5 years ago

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

History

#1 Updated by rbarlow over 5 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!

#2 Updated by rbarlow over 5 years ago

  • Status changed from ASSIGNED to POST

#3 Updated by rbarlow over 5 years ago

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

#4 Updated by rbarlow about 5 years ago

  • Platform Release changed from master to 2.8.0

#5 Updated by dkliban@redhat.com almost 5 years ago

  • Status changed from MODIFIED to 5

#6 Updated by rbarlow almost 5 years ago

  • Status changed from 5 to 6

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

#7 Updated by dkliban@redhat.com over 4 years ago

  • Status changed from 6 to CLOSED - CURRENTRELEASE

#9 Updated by bmbouter over 2 years ago

  • Sprint set to May 2015

#10 Updated by bmbouter over 2 years ago

  • Sprint/Milestone deleted (16)

#11 Updated by bmbouter over 1 year ago

  • Tags Pulp 2 added

Please register to edit this issue

Also available in: Atom PDF