t_pkg_depotd.py revision 2859
290N/A# The contents of this file are subject to the terms of the 290N/A# Common Development and Distribution License (the "License"). 290N/A# You may not use this file except in compliance with the License. 290N/A# See the License for the specific language governing permissions 290N/A# and limitations under the License. 290N/A# When distributing Covered Code, include this CDDL HEADER in each 290N/A# If applicable, add the following below this CDDL HEADER, with the 290N/A# fields enclosed by brackets "[]" replaced with your own identifying 290N/A# information: Portions Copyright [yyyy] [name of copyright owner] 290N/A# Copyright (c) 2008, 2013, Oracle and/or its affiliates. All rights reserved. add dir mode=0755 owner=root group=bin path=/bin add file tmp/cat mode=0555 owner=root group=bin path=/bin/cat add set name="description" value="Package to test package names with slashes" add dir path=tmp/foo mode=0755 owner=root group=bin add depend type=require fmri=pkg:/SUNWcsl add depend type=incorporate fmri=pkg:/foo # This suite, for obvious reasons, actually needs a depot. """ Ping the depot several times """ """ Start and stop the depot several times """ """ Send package quux@1.0 an action at a time, restarting the depot server after each one is sent, to ensure that transactions work across depot restart. Then verify that the package was successfully added by performing some """Publish a package and then verify that the depot /info operation doesn't fail.""" """Verify that a depot will return a 400 (Bad Request) error whenever it is provided malformed FMRIs.""" for entry in (
"BRCMbnx",
"BRCMbnx%40a",
"BRCMbnx%400.5.11%2C5.11-0.101%3A20081119T231649a"):
"""Publish a package with slashes in the name, and then verify that the depot manifest and info operations work regardless of # First, try it un-encoded. # Second, try it encoded. """Testing depotcontroller.refresh().""" """Verify that files outside of the package content web root cannot be accessed, and that files inside can be.""" # any attempts to go outside that directory should fail """Verify that starting a depot server in readonly mode with a non-existent or empty repo_dir fails and that permissions errors are handled correctly during creation. Then verify that starting a depot with the same directory in publishing mode works and then a readonly depot again after that works. # First, test readonly mode with a repo_dir that doesn't exist. # Next, test readonly mode with a repo_dir that is empty. # Next, test readwrite (publishing) mode with a non-existent # Next, test readwrite (publishing) mode with a non-existent # repo_dir for an unprivileged user. # Even if this test fails, this wrapper must be reset. # Next, test readwrite (publishing) mode with an empty repo_dir. # Finally, re-test readonly mode now that the repository has """Test that if a depot has a partially finished append transaction, that it reopens it correctly.""" """Test that sending a non-signature action to an append transaction results in an error.""" "owner=root group=bin",
exit=
1)
"""Verify that the depot server accepts a link to a directory as a repository root.""" # Create a link to the repository and verify that # the depot server allows it. # Reset for any tests that might execute afterwards. Test that a version-less incorporate dependency in a package doesn't cause a traceback and a 404 in the BUI. """Tests whether the index and feed cache file are written to the writable root parameter.""" "not found at '%s'." %
feed)
"""Verify that disable-ops works as expected.""" # For this disabled case, /catalog/1/ should return # For this disabled case, all /catalog/ operations should return # In the normal case, /catalog/1/ should return # A bogus operation should prevent the depot from starting. # Since these tests are output sensitive, the depots should be purged add dir mode=0755 owner=root group=bin path=/bin add dir mode=0755 owner=root group=bin path=/var add set name="description" value="Package to test package names with slashes" add dir path=tmp/foo mode=0755 owner=root group=bin add depend type=require fmri=pkg:/SUNWcsl open zfs-extras@1.0,5.11-0 "prefix":
"org.opensolaris.pending" "collection_type":
"supplemental",
"Development packages for the contrib repository.",
"name":
""""Pending" Repository""",
"origins": [],
# Has to be set during setUp for correct origin. "refresh_seconds":
86400,
# Prevent override of custom configuration; # tests will set as needed. """Verify that a non-error response and valid HTML is returned for each known BUI page in every available depot mode.""" # A list of tuples containing the name of the method used to set # the mode, and then the method needed to unset that mode. (
"set_mirror",
"unset_mirror"),
(
"set_readonly",
"set_readwrite"),
# Create repository and set publisher origins. # Any error responses will cause an # Because the 'role' attribute used for # screen readers and other accessibility # tools isn't part of the official XHTML # 1.x standards, it has to be dropped # for the document to be validated. # Setting 'drop_prop_attrs' to True here # does that while ensuring that the # output of the depot is otherwise """Helper function to generate test repository configuration.""" # Find and load the repository configuration. # Update the configuration with our sample data. # Apply publisher properties and update. """Verify the output of the depot /publisher operation.""" # Now update the repository configuration while the depot is # stopped so changes won't be overwritten on exit. # Now verify that the parsed response has the expected data. """Verify the output of the depot /publisher operation.""" # Now update the repository configuration while the depot is # stopped so changes won't be overwritten on exit. # Then, publish some packages we can abuse for testing. # Now, for each published package, attempt to get a p5i file # and then verify that the parsed response has the expected # package information under the expected publisher. # p5i files contain non-qualified FMRIs as the FMRIs # are already grouped by publisher. # Try again, but only using package stems. # Try again, but using wildcards (which will return a list of # matching package stems). # Finally, verify that a non-existent package will error out # with a httplib.NOT_FOUND. """Ensure expected headers are present for client operations (excluding publication).""" # Now update the repository configuration while the depot is # stopped so changes won't be overwritten on exit. # Wait for search indexing to complete. for req_path in (
"publisher/0",
'search/0/%2Fvar%2Ffile',
'search/1/False_2_None_None_%2Fvar%2Ffile',
"catalog/0",
"catalog/1/catalog.attrs",
"file/0/3aad0bca6f3a6f502c175700ebe90ef36e312d7e",
# Fields must be referenced in lowercase. "no-cache, no-transform, must-revalidate")
"no-transform, max-age="))
for req_path in (
"catalog/1/catalog.hatters",
"file/0/3aad0bca6f3a6f502c175700ebe90ef36e312d7f"):
"""Test to make sure BUI search doesn't trigger a traceback.""" # Now update the repository configuration while the depot is # stopped so changes won't be overwritten on exit. # Then, publish some packages we can abuse for testing. "action=Advanced+Search")
"""Verify that depot address can be set.""" # Check that IPv6 address can be used. # Check that we can retrieve something.