Commit Graph

40 Commits

Author SHA1 Message Date
Alistair Coles 8e051c5b8e docs: Fix link to sphinx project page
Change-Id: I5e75a359660315a34ec36f5cb748808257f4185a
2023-07-21 10:19:49 +01:00
Alexander Fadeev 49ba1bc33a Present `pytest` steps in development guidelines
Explain how to prepare venv with `tox devenv`

Closes-Bug: #2003984
Change-Id: Idc536034a36646de9c1880c8d0bc0a387b130ac2
2023-02-25 02:01:07 +02:00
Tim Burke ef155bd74a Switch to pytest
nose has not seen active development for many years now. With py310, we
can no longer use it due to import errors.

Also update lower contraints

Closes-Bug: #1993531
Change-Id: I215ba0d4654c9c637c3b97953d8659ac80892db8
2022-12-09 11:38:02 -08:00
Alistair Coles 5d9f1f009c s3api tests: allow AWS credential file loading
When switching the s3api cross-compatibility tests' target between a
Swift endpoint and an S3 endpoint, allow specifying an AWS CLI style
credentials file as an alternative to editing the swift 'test.conf'
file.

Change-Id: I5bebca91821552d7df1bc7fa479b6593ff433925
2022-06-01 21:46:41 -07:00
Nguyen Hai 4409da697f Update doc building instructions in Development Guidelines
Change-Id: Ifd2f468ad745d19ef474ae7503a8bd79d429fc1b
2018-07-06 07:40:52 +00:00
Tovin Seven 9b90498b07 Trivial: Update pypi url to new url
Pypi url changed from [1] to [2]

[1] https://pypi.python.org/pypi/<package>
[2] https://pypi.org/project/<package>

Change-Id: Ic639298e83189410395f31cc9ef60076af479efd
2018-04-20 17:30:47 +07:00
Samuel Merritt 728b4ba140 Add checksum to object extended attributes
Currently, our integrity checking for objects is pretty weak when it
comes to object metadata. If the extended attributes on a .data or
.meta file get corrupted in such a way that we can still unpickle it,
we don't have anything that detects that.

This could be especially bad with encrypted etags; if the encrypted
etag (X-Object-Sysmeta-Crypto-Etag or whatever it is) gets some bits
flipped, then we'll cheerfully decrypt the cipherjunk into plainjunk,
then send it to the client. Net effect is that the client sees a GET
response with an ETag that doesn't match the MD5 of the object *and*
Swift has no way of detecting and quarantining this object.

Note that, with an unencrypted object, if the ETag metadatum gets
mangled, then the object will be quarantined by the object server or
auditor, whichever notices first.

As part of this commit, I also ripped out some mocking of
getxattr/setxattr in tests. It appears to be there to allow unit tests
to run on systems where /tmp doesn't support xattrs. However, since
the mock is keyed off of inode number and inode numbers get re-used,
there's lots of leakage between different test runs. On a real FS,
unlinking a file and then creating a new one of the same name will
also reset the xattrs; this isn't the case with the mock.

The mock was pretty old; Ubuntu 12.04 and up all support xattrs in
/tmp, and recent Red Hat / CentOS releases do too. The xattr mock was
added in 2011; maybe it was to support Ubuntu Lucid Lynx?

Bonus: now you can pause a test with the debugger, inspect its files
in /tmp, and actually see the xattrs along with the data.

Since this patch now uses a real filesystem for testing filesystem
operations, tests are skipped if the underlying filesystem does not
support setting xattrs (eg tmpfs or more than 4k of xattrs on ext4).

References to "/tmp" have been replaced with calls to
tempfile.gettempdir(). This will allow setting the TMPDIR envvar in
test setup and getting an XFS filesystem instead of ext4 or tmpfs.

THIS PATCH SIGNIFICANTLY CHANGES TESTING ENVIRONMENTS

With this patch, every test environment will require TMPDIR to be
using a filesystem that supports at least 4k of extended attributes.
Neither ext4 nor tempfs support this. XFS is recommended.

So why all the SkipTests? Why not simply raise an error? We still need
the tests to run on the base image for OpenStack's CI system. Since
we were previously mocking out xattr, there wasn't a problem, but we
also weren't actually testing anything. This patch adds functionality
to validate xattr data, so we need to drop the mock.

`test.unit.skip_if_no_xattrs()` is also imported into `test.functional`
so that functional tests can import it from the functional test
namespace.

The related OpenStack CI infrastructure changes are made in
https://review.openstack.org/#/c/394600/.

Co-Authored-By: John Dickinson <me@not.mn>

Change-Id: I98a37c0d451f4960b7a12f648e4405c6c6716808
2017-11-03 13:30:05 -04:00
Kota Tsuyuzaki 1e79f828ad Remove all post_as_copy related code and configes
It was deprecated and we discussed on this topic in Denver PTG
for Queen cycle. Main motivation for this work is that deprecated
post_as_copy option and its gate blocks future symlink work.

Change-Id: I411893db1565864ed5beb6ae75c38b982a574476
2017-09-16 05:50:41 +00:00
Alistair Coles 5f610c76bd Support EC policy for in process functional tests
Add support for a 2+1 EC policy to be optionally used as default
policy when running in process functional tests.

The EC policy may be selected by setting the env var:

  SWIFT_TEST_IN_PROCESS_CONF_LOADER=ec tox

when running .functests, or by using the new tox test env:

  tox -e func-ec

Change-Id: I02e3553a74a024efdab91dcd609ac1cf4e4f3208
2017-03-09 10:42:34 +00:00
Alistair Coles b5530f4620 Bring docs inline with changes to tox envs
Make development guidelines consistent with recent
changes to tox envs, specifically the removal of
"-in-process" from some test env names [1] and the
removal of the "func-fast-post" test env [2].

[1] Related-Change: I02477d81b836df71780942189d37d616944c4dce
[2] Related-Change: I6faf8fcfa0a1d96aaf0f5e0ad2106b2b416da22f

Change-Id: I08b92c005ee50beff09a92b4331dd7dbeed79bde
2017-01-25 17:29:56 +00:00
Tim Burke c4d455ca03 Minor dev guidelines formatting fixes
Change-Id: I650bc69bed98ac3cd45c79caaf4007d713e21fd9
2017-01-19 16:53:35 -08:00
Alistair Coles fc24a2322d Add pip and virtualenv upgrade to development guidelines
Change [1] requires pip >= 7.0.1. In general, test
environments will need to have pip and virtualenv in line
with global requirements. Add a reference to the global
requirements rather than specifying versions that will
inevitably become stale.

Also adds inline literal markup to all occurences of "tox"
for consistency.

[1] Related-Change: I7c60be623b4340ee34ae1aa520f17b303348811d

Change-Id: I7730f22c594a3521973cb9ff264a7d50f2b86a1a
Depends-On: I45eee626713438af5fc676f2b5f636d7ec23f7be
2016-11-24 11:38:10 +00:00
Thiago da Silva ddbab05094 add reminder how to run debug func tests
added comments on how to run in_process and specific
test cases

Change-Id: I485755996b15753323d30de09914d35e262fcedc
Signed-off-by: Thiago da Silva <thiago@redhat.com>
2016-08-09 15:42:20 -04:00
Jenkins 4521eb6e2e Merge "Enable in-process func tests to optionally use encryption" 2016-08-01 21:14:18 +00:00
Janie Richling 66520146cf Enable in-process func tests to optionally use encryption
Running functional tests in the in-process mode uses
the default value for the pipeline.  This patch adds support
to specify the SWIFT_TEST_IN_PROCESS_CONF_LOADER variable
to point to a labeled function that changes the proxy
configuration for the functional test.

The patch also adds a new tox environment
func-in-process-encryption
which runs with the environment variable
SWIFT_TEST_IN_PROCESS_CONF_LOADER=encryption

The motivation for this change is to put support in place for an
upstream CI job that will functionally test using encryption
middleware in the pipeline.  The gate job is proposed at:
https://review.openstack.org/#/c/348292/

Change-Id: I15c4b20f1d2be57ae21c69c614f6a9579145bee9
2016-07-28 14:19:48 -05:00
Jenkins 9501d9617c Merge "Document how to run a single functional test" 2016-07-27 10:46:05 +00:00
Alistair Coles 7cc2392611 Document how to run a single functional test
Change-Id: Icabc5a8316f5e8fd887bb42358ad03e9c43d0765
2016-07-26 18:14:06 +01:00
Alistair Coles 77e476376c Mention SWIFT_TEST_DEBUG_LOGS in development guide
Change-Id: If764de0a28f5afb858b3e892b35fe5fa147a0650
2016-07-26 17:48:48 +01:00
Andreas Jaeger 92274d4790 List system dependencies for running common tests
Add an other-requirements.txt file containing a cross-platform list of
dependencies needed for running included tox-based tests. Also include a
tox environment for convenience calling the bindep[*] utility to list
any missing system requirements.

Document bindep and other-requirements usage.

This change is self-testing.

For other-requirements.txt see also
http://docs.openstack.org/infra/manual/drivers.html#package-requirements

[*] http://docs.openstack.org/infra/bindep/

Change-Id: Iea6f5fecba3b7cb9f6dac7029c0f17fc31fc0e3c
2016-05-12 08:51:31 +02:00
Alistair Coles 3ac7cab32b Remove reference to py26 in tox testing instructions
Also change some rst formatting and clarify that tox
is used to run more than just *unit* tests.

Change-Id: I263af7b4f7a554da3a391cf5104af573c89e3825
2016-03-11 11:50:49 +00:00
Jenkins bf4c26d7ef Merge "Enable in-process func tests to optionally use fast-post" 2016-02-11 08:29:56 +00:00
Ondřej Nový cc8dc88b55 Script for checking sanity of manpages
Change-Id: Ia27b0ecf6a3267eb51f8a6562721dca72f128915
2016-02-10 14:16:56 -08:00
Alistair Coles c7e5e12500 Enable in-process func tests to optionally use fast-post
Running functional tests in the in-process mode uses
the default value for proxy-server object_post_as_copy,
which is True. This patch adds support for an environment
variable to change this value to False so that the fast-post
mode is tested when running in-process functional tests.

The patch also adds a new tox environment func-in-process-fast-post
which forces in-process functional testing with
object_post_as_copy=False.

The motivation for this change, apart from enabling configurable
local testing, is to put support in place for an upstream CI job
that will actually functionally test the fast-post mode, which is
otherwise only covered by unit tests.

There are currently two gate jobs that run the functional tests:

- gate-swift-dsvm-functional runs the tests *twice* against a
  devstack swift service, once using tempauth and once using
  keystoneauth. The devstack swift service uses the default
  object_post_as_copy=True.

- gate-swift-tox-func runs the func tests in in-process mode
  which also uses tempauth and object_post_as_copy=True. This
  duplicates one of the config scenarios above.

With this change either the gate-swift-tox-func job or a new job
could run the functional tests using object_post_as_copy=False.

Change-Id: Ia37f6df1dc38e44ef7404fbf0a52f6fc22fae0c2
2016-02-01 12:39:39 +00:00
Alistair Coles 1a2b54fc0a Fix missing *-replicator conf sections in deployment guide
The doc for these sections was missing because of an rst error - the
source is there in rst file but didn't make it into the html output.

Add doc for per_diff and max_diffs in account and container doc sections.

Also, fix a bunch of other sphinx build errors and most of the warnings.

Change-Id: If9ed2619b2f92c6c65a94f41d8819db8726d3893
2015-10-23 14:58:38 +01:00
Hamdi Roumani f563a423bf Updated tox setup instructions on Development Guidelines
The instructions suggest updating the ownership of the swift.egg-info
directory may be required and provide a cmd to do so.  Said cmd assumes user
'swift' exists, but tox will require the current user to have access to the
directory to perform updates, moreover user swift may not exist at all.

Change-Id: I63951970553c086ff4f1ac65a81559ba69166494
2015-07-22 15:27:26 -04:00
Jenkins 2107fe89c7 Merge "Select policy when running functional test" 2015-07-17 00:26:44 +00:00
Christian Schwede f1f4bb30cd Fix testing issues
When functional tests are run in tox and an exception is raised when connecting
to Swift (for example: Swift not running, missing python-keystoneclient package
used by python-swiftclient) 0 tests are executed, but tox returns a success.

An exception is raised during tests, caused by a missing python-keystoneclient
in python-swiftclient. Instead of adding python-keystoneclient as a dependency
in python-swiftclient the package is added to the test-requirements.txt in Swift
itself. Note that adding python-keystoneclient to the test-requirements in
python-swiftclient is not sufficient (it's already in there).

The exception in setup_package() is catched by the openstack.nose_plugin, thus
disabling this plugin for now as well.

Also fixing two test errors seen on the gate regarding the tempurl middleware.

There was also an update to tox, environment variables were no longer passed
with versions >= 2.0 (http://tox.readthedocs.org/en/latest/changelog.html).
Swift test environment variables have been added to the passenv to re-enable the
former behavior, as well as environment variables required to pass proxy
settings.

This also led to skipped tempauth tests, and together with the missing
python-keystoneclient no tests were executed.

Related-Bug: 1461440
Related-Bug: 1455102

Co-Authored-By: Alistair Coles <alistair.coles@hp.com>

Change-Id: Ideea071017d04912c60ed0bc76532adbb446c31d
2015-06-03 14:13:14 +01:00
John Dickinson 5374ba3a80 drop Python 2.6 testing support
Change-Id: I78f21e5794e8ba7a095f03d279247516a241f555
2015-05-27 12:28:04 -07:00
Thiago da Silva 7bdb8266d4 Select policy when running functional test
Add ability to select a storage policy when running
the functional tests by defining the environment variable
SWIFT_TEST_POLICY.

This patch was first introduced by Janie Richling in
feature/ec: https://review.openstack.org/#/c/166097

Co-Authored-By: Janie Richling <jrichli@us.ibm.com>
Co-Authored-By: Christian Schwede <christian.schwede@enovance.com>
Co-Authored-By: Kota Tsuyuzaki <tsuyuzaki.kota@lab.ntt.co.jp>
Co-Authored-By: Alistair Coles <alistair.coles@hp.com>

Change-Id: Id96354546088df137def0ae7fd434baf64ed0c51
Signed-off-by: Thiago da Silva <thiago@redhat.com>
2015-04-06 16:35:58 +00:00
Alistair Coles 7e64c811fe Enable in-process functional test policy to be configured
Currently the in-process tests build a 2 replica, 4 partition,
2 device object ring. This patch allows an alternative policy
and ring to be specified for testing via environment variables
that may optionally be set.

SWIFT_TEST_IN_PROCESS_CONF_DIR - This points the test setup to a
  directory which may have a swift.conf file and ring file. The
  test setup will then prefer these conf files over the samples
  in '/etc'.

SWIFT_TEST_POLICY - This causes the in-process test to
  use the specified policy from the swift.conf file and its
  associated ring for testing (first copying the conf and ring file
  and modifying device parameters to suit in-process testing). If
  not set, the tests will use the default policy.

The in-process tests now start sufficient object servers for the
ring file being tested against.

This should allow in-process functional testing of various policies
and rings (e.g. EC policies) without needing to reconfigure an SAIO
for each test scenario.

The refactoring of the in_process test setup code should also
allow easier addition of other 'hard-coded' test policies/rings
in the future.

Change-Id: I24f5a13de3d296b400da1691dcb53423a9f8a463
2015-03-20 16:13:57 +00:00
Peter Portante 3e04606f87 Add a env var to use in-memory obj server in func
Add an environment variable to enable the use of the in-memory object
server during in-process functional test runs.

It might be worth-while to just run under both object servers in-tree,
but this at least enables it, without having to figure out how to make
two test runs in two different environments.

DocImpact

Change-Id: Id76b008e1f273c639ae61550affddc32c5d7c419
Signed-off-by: Thiago da Silva <thiago@redhat.com>
2014-08-04 16:54:50 +01:00
Chmouel Boudjnah 18a0813d9b Add documentation about flake8+hacking.
- Fixes bug 1201431.

Change-Id: If025a41caf3a629b9efb4d67c53c423796d37a91
2013-07-15 17:14:16 +02:00
David Hadas 39fc4c37bf Doc changes for new pip-requirements
dnspython was added recently to the list of requirments.

This patch completes the change:
1. The new requirement is documented
2. The need for tox --recreate is documented
(assuming there is no way to automate 2 above)

Change-Id: I49f0cb4b01b79dd7cf4329984a2f8416378ebe19
Fixes: Bug #1176627
2013-05-06 19:21:53 +03:00
Jenkins e4e55588fb Merge "Replaces Copyright statements for LLC with Foundation, removes date." 2013-02-12 06:25:45 +00:00
annegentle 72428434f7 Replaces Copyright statements for LLC with Foundation, removes date.
Replaced GA code for cross-domain tracking.

Patchset addresses reviewer's comments
and follows new guidance from Foundation:
http://wiki.openstack.org/Documentation/Copyright

Adds current year to each Sphinx-built page.

Addresses only the docs copyright attribution, not code files.

Change-Id: Ib90fd1c92c8fafce2db821bc2b17cef1377cfc1e
2013-02-11 16:32:33 -06:00
David Hadas 83d89228a9 minor development doc changes
Reviewed development saio and guidelines while installing
a new dev and test node.

Change-Id: I59238a4d43fa08a89be14f43681ad4693f1261dd
2013-02-09 11:11:05 +02:00
John Dickinson 1ecf5ebba1 updated copyright date for all files
Change-Id: Ifd909d3561c2647770a7e0caa3cd91acd1b4f298
2012-03-19 13:45:34 -05:00
Maru Newby e6ea310751 Add support for venv-based test run with tox.
* Adds tox config
   - based on the config from python-quantumclient and updated for
     test, pep8 and coverage execution as per nova's run_tests.sh.
 * Adds nosetests defaults in setup.cfg
 * Adds runtime dependencies in tools/pip-requires
   - dependencies were gathered by referencing the packages used in
     creation of a Swift All In One.  Versions were determined by
     checking the swift-core/trunk ppa or, failing that, the version
     available in lucid.
 * Adds test dependencies in tools/test-requires
 * Updates swift/common/middleware/formpost.py for pep8 compliance
 * Adds instructions for executing the tests with Tox to the
   developer_guidelines
 * Adds instructions for installing openstack.nose_plugin to
   developer_saio
 * Fixes bug 909177

Change-Id: I5407924d2181e9ab335aaf76bf30c8d40deccbb4
2012-03-07 22:44:34 -08:00
Anne Gentle 8823427161 Changed copyright notices on py files and the single rst file with a copyright notice 2011-01-04 17:34:43 -06:00
Chuck Thier 001407b969 Initial commit of Swift code 2010-07-12 17:03:45 -05:00