src/tests/cli/t_api_search.py
author Shawn Walker <srw@sun.com>
Fri, 23 Oct 2009 17:43:37 -0500
changeset 1431 62b6033670e4
parent 1423 06e5797f2786
child 1461 fdf40c8c6765
permissions -rw-r--r--
10416 server catalog v1 support desired 243 need localized descriptions, other metadata at catalog level 2424 Need to use UTC consistently everywhere 3092 messaging api/framework needed for pkg clients (cli, gui, etc.) 7063 "pkg list -a -s" needs performance improvement 7163 manifests are modified by client before being written to disk 8217 package fmri should be added to manifest during publishing 9061 importer should not refresh indexes 9446 traceback for cfg_cache operations if read-only filesystem 10415 client catalog v1 support desired 11094 Client transport for catalog v1 11523 only permit FMRIs from same publisher for network repositories 11831 server api version incompatible templates can cause traceback 11832 depot needs ability to seed / alter repository configuration 11954 importer shows zero packages processed unless debug enabled 12006 merge utility should have a test suite
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
941
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
     1
#!/usr/bin/python2.4
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
     2
#
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
     3
# CDDL HEADER START
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
     4
#
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
     5
# The contents of this file are subject to the terms of the
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
     6
# Common Development and Distribution License (the "License").
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
     7
# You may not use this file except in compliance with the License.
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
     8
#
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
     9
# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
    10
# or http://www.opensolaris.org/os/licensing.
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
    11
# See the License for the specific language governing permissions
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
    12
# and limitations under the License.
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
    13
#
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
    14
# When distributing Covered Code, include this CDDL HEADER in each
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
    15
# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
    16
# If applicable, add the following below this CDDL HEADER, with the
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
    17
# fields enclosed by brackets "[]" replaced with your own identifying
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
    18
# information: Portions Copyright [yyyy] [name of copyright owner]
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
    19
#
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
    20
# CDDL HEADER END
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
    21
#
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
    22
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
    23
# Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
    24
# Use is subject to license terms.
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
    25
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
    26
import testutils
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
    27
if __name__ == "__main__":
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
    28
	testutils.setup_environment("../../../proto")
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
    29
1230
4bc74e5d6c3d 10046 client always rereads dictionaries
Brock Pytlik <bpytlik@sun.com>
parents: 1191
diff changeset
    30
import copy
4bc74e5d6c3d 10046 client always rereads dictionaries
Brock Pytlik <bpytlik@sun.com>
parents: 1191
diff changeset
    31
import difflib
941
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
    32
import os
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
    33
import re
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
    34
import shutil
1230
4bc74e5d6c3d 10046 client always rereads dictionaries
Brock Pytlik <bpytlik@sun.com>
parents: 1191
diff changeset
    35
import sys
4bc74e5d6c3d 10046 client always rereads dictionaries
Brock Pytlik <bpytlik@sun.com>
parents: 1191
diff changeset
    36
import tempfile
941
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
    37
import time
1230
4bc74e5d6c3d 10046 client always rereads dictionaries
Brock Pytlik <bpytlik@sun.com>
parents: 1191
diff changeset
    38
import unittest
1291
0f82f71cbf19 9845 Query.fromstr needs more error handling
Brock Pytlik <bpytlik@sun.com>
parents: 1286
diff changeset
    39
import urllib2
941
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
    40
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
    41
import pkg.client.api as api
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
    42
import pkg.client.api_errors as api_errors
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
    43
import pkg.client.query_parser as query_parser
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
    44
import pkg.client.progress as progress
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
    45
import pkg.fmri as fmri
1286
2e5bb564a9e2 8948 search errors should make it clear that the rest of the command worked
Brock Pytlik <bpytlik@sun.com>
parents: 1271
diff changeset
    46
import pkg.indexer as indexer
941
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
    47
import pkg.portable as portable
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
    48
import pkg.search_storage as ss
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
    49
1352
5c92c9d342ef 11065 client v1 catalog support for v0 catalogs
Shawn Walker <srw@sun.com>
parents: 1325
diff changeset
    50
API_VERSION = 21
941
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
    51
PKG_CLIENT_NAME = "pkg"
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
    52
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
    53
class TestApiSearchBasics(testutils.SingleDepotTestCase):
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
    54
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
    55
        example_pkg10 = """
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
    56
            open [email protected],5.11-0
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
    57
            add dir mode=0755 owner=root group=bin path=/bin
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
    58
            add dir mode=0755 owner=root group=bin path=/bin/example_dir
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
    59
            add dir mode=0755 owner=root group=bin path=/usr/lib/python2.4/vendor-packages/OpenSSL
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
    60
            add file /tmp/example_file mode=0555 owner=root group=bin path=/bin/example_path
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
    61
            add set name=com.sun.service.incorporated_changes value="6556919 6627937"
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
    62
            add set name=com.sun.service.random_test value=42 value=79
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
    63
            add set name=com.sun.service.bug_ids value="4641790 4725245 4817791 4851433 4897491 4913776 6178339 6556919 6627937"
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
    64
            add set name=com.sun.service.keywords value="sort null -n -m -t sort 0x86 separator"
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
    65
            add set name=com.sun.service.info_url value=http://service.opensolaris.com/xml/pkg/[email protected],5.11-1:20080514I120000Z
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
    66
            add set description='FOOO bAr O OO OOO'
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
    67
            add set name='weirdness' value='] [ * ?'
1423
06e5797f2786 11965 stub signature action needed
Brock Pytlik <bpytlik@sun.com>
parents: 1364
diff changeset
    68
            add signature pkg.sig_bit1=sig_bit_val1 pkg.sig_bit2=sig_bit_val2
941
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
    69
            close """
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
    70
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
    71
        example_pkg11 = """
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
    72
            open [email protected],5.11-0
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
    73
            add dir mode=0755 owner=root group=bin path=/bin
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
    74
            add file /tmp/example_file mode=0555 owner=root group=bin path=/bin/example_path11
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
    75
            close """
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
    76
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
    77
        another_pkg10 = """
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
    78
            open [email protected],5.11-0
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
    79
            add dir mode=0755 owner=root group=bin path=/bin
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
    80
            add dir mode=0755 owner=root group=bin path=/bin/another_dir
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
    81
            add file /tmp/example_file mode=0555 owner=root group=bin path=/bin/another_path
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
    82
            add set name=com.sun.service.incorporated_changes value="6556919 6627937"
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
    83
            add set name=com.sun.service.random_test value=42 value=79
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
    84
            add set name=com.sun.service.bug_ids value="4641790 4725245 4817791 4851433 4897491 4913776 6178339 6556919 6627937"
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
    85
            add set name=com.sun.service.keywords value="sort null -n -m -t sort 0x86 separator"
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
    86
            add set name=com.sun.service.info_url value=http://service.opensolaris.com/xml/pkg/[email protected],5.11-1:20080514I120000Z
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
    87
            close """
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
    88
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
    89
        bad_pkg10 = """
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
    90
            open [email protected],5.11-0
1127
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
    91
            add dir path=badfoo/ mode=0755 owner=root group=bin
941
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
    92
            close """
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
    93
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
    94
        space_pkg10 = """
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
    95
            open [email protected],5.11-0
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
    96
            add file /tmp/example_file mode=0444 owner=nobody group=sys path='unique/with a space'
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
    97
            add dir mode=0755 owner=root group=bin path=unique_dir
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
    98
            close """
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
    99
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
   100
        cat_pkg10 = """
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
   101
            open [email protected],5.11-0
1115
fae096bd02df 8865 attribute.generate_indicies doesn't handle multivalued info.category actions
Brock Pytlik <bpytlik@sun.com>
parents: 1102
diff changeset
   102
            add set name=info.classification value=org.opensolaris.category.2008:System/Security value=org.random:Other/Category
941
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
   103
            close """
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
   104
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
   105
        cat2_pkg10 = """
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
   106
            open [email protected],5.11-0
1115
fae096bd02df 8865 attribute.generate_indicies doesn't handle multivalued info.category actions
Brock Pytlik <bpytlik@sun.com>
parents: 1102
diff changeset
   107
            add set name=info.classification value="org.opensolaris.category.2008:Applications/Sound and Video" value=Developer/C
941
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
   108
            close """
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
   109
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
   110
        cat3_pkg10 = """
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
   111
            open [email protected],5.11-0
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
   112
            add set name=info.classification value="org.opensolaris.category.2008:foo/bar/baz/bill/beam/asda"
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
   113
            close """
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
   114
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
   115
        bad_cat_pkg10 = """
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
   116
            open [email protected],5.11-0
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
   117
            add set name=info.classification value="TestBad1/TestBad2"
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
   118
            close """
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
   119
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
   120
        bad_cat2_pkg10 = """
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
   121
            open [email protected],5.11-0
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
   122
            add set name=info.classification value="org.opensolaris.category.2008:TestBad1:TestBad2"
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
   123
            close """
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
   124
1127
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
   125
        fat_pkg10 = """
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
   126
open [email protected],5.11-0
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
   127
add set name=variant.arch value=sparc value=i386
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
   128
add set name=description value="i386 variant" variant.arch=i386
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
   129
add set name=description value="sparc variant" variant.arch=sparc
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
   130
close """
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
   131
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
   132
        bogus_pkg10 = """
1431
62b6033670e4 10416 server catalog v1 support desired
Shawn Walker <srw@sun.com>
parents: 1423
diff changeset
   133
set name=pkg.fmri value=pkg:/[email protected],5.11-0:20090326T233451Z
1127
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
   134
set name=description value=""validation with simple chains of constraints ""
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
   135
set name=pkg.description value="pseudo-hashes as arrays tied to a "type" (list of fields)"
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
   136
depend fmri=XML-Atom-Entry
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
   137
set name=com.sun.service.incorporated_changes value="6556919 6627937"
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
   138
"""
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
   139
        bogus_fmri = fmri.PkgFmri("[email protected],5.11-0:20090326T233451Z")
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
   140
1431
62b6033670e4 10416 server catalog v1 support desired
Shawn Walker <srw@sun.com>
parents: 1423
diff changeset
   141
        remote_fmri_string = ('pkg:/[email protected]', 'test/example_pkg',
62b6033670e4 10416 server catalog v1 support desired
Shawn Walker <srw@sun.com>
parents: 1423
diff changeset
   142
            'set name=pkg.fmri value=pkg://test/[email protected],5.11-0:')
62b6033670e4 10416 server catalog v1 support desired
Shawn Walker <srw@sun.com>
parents: 1423
diff changeset
   143
62b6033670e4 10416 server catalog v1 support desired
Shawn Walker <srw@sun.com>
parents: 1423
diff changeset
   144
        res_remote_pkg = set([
62b6033670e4 10416 server catalog v1 support desired
Shawn Walker <srw@sun.com>
parents: 1423
diff changeset
   145
            remote_fmri_string
62b6033670e4 10416 server catalog v1 support desired
Shawn Walker <srw@sun.com>
parents: 1423
diff changeset
   146
        ])
62b6033670e4 10416 server catalog v1 support desired
Shawn Walker <srw@sun.com>
parents: 1423
diff changeset
   147
941
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
   148
        res_remote_path = set([
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
   149
            ("pkg:/[email protected]", "basename","file 820157a2043e3135f342b238129b556aade20347 chash=bfa46fc98d1ca97f1260090797d35a35e76096a3 group=bin mode=0555 owner=root path=bin/example_path pkg.csize=38 pkg.size=18")
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
   150
        ])
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
   151
1360
fbf184c6d55b 1059 search both original input and paths with image root removed
Brock Pytlik <bpytlik@sun.com>
parents: 1354
diff changeset
   152
        res_remote_path_of_example_path = set([
fbf184c6d55b 1059 search both original input and paths with image root removed
Brock Pytlik <bpytlik@sun.com>
parents: 1354
diff changeset
   153
            ("pkg:/[email protected]", "path","file 820157a2043e3135f342b238129b556aade20347 chash=bfa46fc98d1ca97f1260090797d35a35e76096a3 group=bin mode=0555 owner=root path=bin/example_path pkg.csize=38 pkg.size=18")
fbf184c6d55b 1059 search both original input and paths with image root removed
Brock Pytlik <bpytlik@sun.com>
parents: 1354
diff changeset
   154
        ])
fbf184c6d55b 1059 search both original input and paths with image root removed
Brock Pytlik <bpytlik@sun.com>
parents: 1354
diff changeset
   155
941
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
   156
        res_remote_bin = set([
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
   157
            ("pkg:/[email protected]", "path", "dir group=bin mode=0755 owner=root path=bin")
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
   158
        ])
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
   159
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
   160
        res_remote_openssl = set([
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
   161
            ("pkg:/[email protected]", "basename", "dir group=bin mode=0755 owner=root path=usr/lib/python2.4/vendor-packages/OpenSSL")
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
   162
        ])
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
   163
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
   164
        res_remote_bug_id = set([
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
   165
            ("pkg:/[email protected]", "4851433", 'set name=com.sun.service.bug_ids value="4641790 4725245 4817791 4851433 4897491 4913776 6178339 6556919 6627937"')
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
   166
        ])
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
   167
1127
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
   168
        res_remote_bug_id_4725245 = set([
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
   169
            ("pkg:/[email protected]", "4725245", 'set name=com.sun.service.bug_ids value="4641790 4725245 4817791 4851433 4897491 4913776 6178339 6556919 6627937"')
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
   170
        ])
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
   171
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
   172
941
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
   173
        res_remote_inc_changes = set([
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
   174
            ("pkg:/[email protected]", "6556919", 'set name=com.sun.service.incorporated_changes value="6556919 6627937"'),
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
   175
            ("pkg:/[email protected]", "6556919", 'set name=com.sun.service.bug_ids value="4641790 4725245 4817791 4851433 4897491 4913776 6178339 6556919 6627937"')
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
   176
        ])
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
   177
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
   178
        res_remote_random_test = set([
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
   179
            ("pkg:/[email protected]", "42", "set name=com.sun.service.random_test value=42 value=79")
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
   180
        ])
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
   181
1127
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
   182
        res_remote_random_test_79 = set([
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
   183
            ("pkg:/[email protected]", "79", "set name=com.sun.service.random_test value=42 value=79")
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
   184
        ])
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
   185
941
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
   186
        res_remote_keywords = set([
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
   187
            ("pkg:/[email protected]", "separator", 'set name=com.sun.service.keywords value="sort null -n -m -t sort 0x86 separator"')
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
   188
        ])
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
   189
1127
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
   190
        res_remote_keywords_sort_phrase = set([
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
   191
            ("pkg:/[email protected]", "sort 0x86", 'set name=com.sun.service.keywords value="sort null -n -m -t sort 0x86 separator"')
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
   192
        ])
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
   193
941
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
   194
        res_remote_wildcard = res_remote_path.union(set([
1431
62b6033670e4 10416 server catalog v1 support desired
Shawn Walker <srw@sun.com>
parents: 1423
diff changeset
   195
            remote_fmri_string,
941
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
   196
            ('pkg:/[email protected]', 'basename', 'dir group=bin mode=0755 owner=root path=bin/example_dir')
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
   197
        ]))
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
   198
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
   199
        res_remote_glob = set([
1431
62b6033670e4 10416 server catalog v1 support desired
Shawn Walker <srw@sun.com>
parents: 1423
diff changeset
   200
            remote_fmri_string,
941
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
   201
            ('pkg:/[email protected]', 'path', 'dir group=bin mode=0755 owner=root path=bin/example_dir'),
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
   202
            ('pkg:/[email protected]', 'basename', 'dir group=bin mode=0755 owner=root path=bin/example_dir'),
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
   203
            ('pkg:/[email protected]', 'path', 'file 820157a2043e3135f342b238129b556aade20347 chash=bfa46fc98d1ca97f1260090797d35a35e76096a3 group=bin mode=0555 owner=root path=bin/example_path pkg.csize=38 pkg.size=18')
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
   204
        ]) | res_remote_path
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
   205
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
   206
        res_remote_foo = set([
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
   207
            ('pkg:/[email protected]', 'FOOO', 'set name=description value="FOOO bAr O OO OOO"')
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
   208
        ])
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
   209
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
   210
        res_remote_bar = set([
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
   211
            ('pkg:/[email protected]', 'bAr', 'set name=description value="FOOO bAr O OO OOO"')
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
   212
        ])
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
   213
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
   214
        res_remote_star = set([
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
   215
            ('pkg:/[email protected]', '*', 'set name=weirdness value="] [ * ?"')
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
   216
        ])
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
   217
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
   218
        res_remote_mark = set([
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
   219
            ('pkg:/[email protected]', '?', 'set name=weirdness value="] [ * ?"')
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
   220
        ])
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
   221
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
   222
        res_remote_left_brace = set([
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
   223
            ('pkg:/[email protected]', '[', 'set name=weirdness value="] [ * ?"')
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
   224
        ])
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
   225
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
   226
        res_remote_right_brace = set([
1431
62b6033670e4 10416 server catalog v1 support desired
Shawn Walker <srw@sun.com>
parents: 1423
diff changeset
   227
            ('pkg:/[email protected]', ']', 'set name=weirdness value="] [ * ?"')
941
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
   228
        ])
1431
62b6033670e4 10416 server catalog v1 support desired
Shawn Walker <srw@sun.com>
parents: 1423
diff changeset
   229
1352
5c92c9d342ef 11065 client v1 catalog support for v0 catalogs
Shawn Walker <srw@sun.com>
parents: 1325
diff changeset
   230
        local_fmri_string = ('pkg:/[email protected]', 'test/example_pkg',
1431
62b6033670e4 10416 server catalog v1 support desired
Shawn Walker <srw@sun.com>
parents: 1423
diff changeset
   231
            'set name=pkg.fmri value=pkg://test/[email protected],5.11-0:')
941
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
   232
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
   233
        res_local_pkg = set([
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
   234
                local_fmri_string
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
   235
                ])
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
   236
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
   237
        res_local_path = copy.copy(res_remote_path)
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
   238
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
   239
        res_local_bin = copy.copy(res_remote_bin)
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
   240
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
   241
        res_local_bug_id = copy.copy(res_remote_bug_id)
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
   242
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
   243
        res_local_inc_changes = copy.copy(res_remote_inc_changes)
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
   244
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
   245
        res_local_random_test = copy.copy(res_remote_random_test)
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
   246
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
   247
        res_local_keywords = copy.copy(res_remote_keywords)
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
   248
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
   249
        res_local_wildcard = copy.copy(res_remote_wildcard)
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
   250
        res_local_wildcard.add(local_fmri_string)
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
   251
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
   252
        res_local_glob = copy.copy(res_remote_glob)
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
   253
        res_local_glob.add(local_fmri_string)
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
   254
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
   255
        res_local_foo = copy.copy(res_remote_foo)
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
   256
        res_local_bar = copy.copy(res_remote_bar)
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
   257
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
   258
        res_local_openssl = copy.copy(res_remote_openssl)
1431
62b6033670e4 10416 server catalog v1 support desired
Shawn Walker <srw@sun.com>
parents: 1423
diff changeset
   259
941
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
   260
        res_local_path_example11 = set([
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
   261
            ("pkg:/[email protected]", "basename", "file 820157a2043e3135f342b238129b556aade20347 chash=bfa46fc98d1ca97f1260090797d35a35e76096a3 group=bin mode=0555 owner=root path=bin/example_path11 pkg.csize=38 pkg.size=18")
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
   262
        ])
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
   263
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
   264
        res_local_bin_example11 = set([
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
   265
            ("pkg:/[email protected]", "path", "dir group=bin mode=0755 owner=root path=bin")
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
   266
        ])
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
   267
1325
0cb607b76761 10690 package installed from non-preferred pub include pub prefix in name token
Brock Pytlik <bpytlik@sun.com>
parents: 1291
diff changeset
   268
        res_local_pkg_example11 = set([
1431
62b6033670e4 10416 server catalog v1 support desired
Shawn Walker <srw@sun.com>
parents: 1423
diff changeset
   269
            ("pkg:/[email protected]", "test/example_pkg", "set name=pkg.fmri value=pkg://test/[email protected],5.11-0:")
1325
0cb607b76761 10690 package installed from non-preferred pub include pub prefix in name token
Brock Pytlik <bpytlik@sun.com>
parents: 1291
diff changeset
   270
        ])
0cb607b76761 10690 package installed from non-preferred pub include pub prefix in name token
Brock Pytlik <bpytlik@sun.com>
parents: 1291
diff changeset
   271
941
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
   272
        res_local_wildcard_example11 = set([
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
   273
            ("pkg:/[email protected]", "basename", "file 820157a2043e3135f342b238129b556aade20347 chash=bfa46fc98d1ca97f1260090797d35a35e76096a3 group=bin mode=0555 owner=root path=bin/example_path11 pkg.csize=38 pkg.size=18"),
1325
0cb607b76761 10690 package installed from non-preferred pub include pub prefix in name token
Brock Pytlik <bpytlik@sun.com>
parents: 1291
diff changeset
   274
        ]).union(res_local_pkg_example11)
941
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
   275
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
   276
        res_cat_pkg10 = set([
1115
fae096bd02df 8865 attribute.generate_indicies doesn't handle multivalued info.category actions
Brock Pytlik <bpytlik@sun.com>
parents: 1102
diff changeset
   277
            ('pkg:/[email protected]', 'System/Security', 'set name=info.classification value=org.opensolaris.category.2008:System/Security value=org.random:Other/Category')
fae096bd02df 8865 attribute.generate_indicies doesn't handle multivalued info.category actions
Brock Pytlik <bpytlik@sun.com>
parents: 1102
diff changeset
   278
        ])
fae096bd02df 8865 attribute.generate_indicies doesn't handle multivalued info.category actions
Brock Pytlik <bpytlik@sun.com>
parents: 1102
diff changeset
   279
fae096bd02df 8865 attribute.generate_indicies doesn't handle multivalued info.category actions
Brock Pytlik <bpytlik@sun.com>
parents: 1102
diff changeset
   280
        res_cat_pkg10_2 = set([
fae096bd02df 8865 attribute.generate_indicies doesn't handle multivalued info.category actions
Brock Pytlik <bpytlik@sun.com>
parents: 1102
diff changeset
   281
            ('pkg:/[email protected]', 'Other/Category', 'set name=info.classification value=org.opensolaris.category.2008:System/Security value=org.random:Other/Category')
941
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
   282
        ])
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
   283
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
   284
        res_cat2_pkg10 = set([
1115
fae096bd02df 8865 attribute.generate_indicies doesn't handle multivalued info.category actions
Brock Pytlik <bpytlik@sun.com>
parents: 1102
diff changeset
   285
            ('pkg:/[email protected]', 'Applications/Sound and Video', 'set name=info.classification value="org.opensolaris.category.2008:Applications/Sound and Video" value=Developer/C')
fae096bd02df 8865 attribute.generate_indicies doesn't handle multivalued info.category actions
Brock Pytlik <bpytlik@sun.com>
parents: 1102
diff changeset
   286
        ])
fae096bd02df 8865 attribute.generate_indicies doesn't handle multivalued info.category actions
Brock Pytlik <bpytlik@sun.com>
parents: 1102
diff changeset
   287
fae096bd02df 8865 attribute.generate_indicies doesn't handle multivalued info.category actions
Brock Pytlik <bpytlik@sun.com>
parents: 1102
diff changeset
   288
        res_cat2_pkg10_2 = set([
fae096bd02df 8865 attribute.generate_indicies doesn't handle multivalued info.category actions
Brock Pytlik <bpytlik@sun.com>
parents: 1102
diff changeset
   289
            ('pkg:/[email protected]', 'Developer/C', 'set name=info.classification value="org.opensolaris.category.2008:Applications/Sound and Video" value=Developer/C')
941
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
   290
        ])
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
   291
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
   292
        res_cat3_pkg10 = set([
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
   293
            ('pkg:/[email protected]', 'foo/bar/baz/bill/beam/asda', 'set name=info.classification value=org.opensolaris.category.2008:foo/bar/baz/bill/beam/asda')
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
   294
        ])
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
   295
1127
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
   296
        res_fat10_i386 = set([
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
   297
            ('pkg:/[email protected]', 'i386', 'set name=description value="i386 variant" variant.arch=i386'),
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
   298
            ('pkg:/[email protected]', 'variant', 'set name=description value="i386 variant" variant.arch=i386'),
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
   299
            ('pkg:/[email protected]', 'i386', 'set name=variant.arch value=sparc value=i386'),
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
   300
        ])
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
   301
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
   302
        res_fat10_sparc = set([
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
   303
            ('pkg:/[email protected]', 'sparc', 'set name=description value="sparc variant" variant.arch=sparc'),
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
   304
            ('pkg:/[email protected]', 'sparc', 'set name=variant.arch value=sparc value=i386'),
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
   305
            ('pkg:/[email protected]', 'variant', 'set name=description value="sparc variant" variant.arch=sparc')
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
   306
        ])
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
   307
1431
62b6033670e4 10416 server catalog v1 support desired
Shawn Walker <srw@sun.com>
parents: 1423
diff changeset
   308
        fat_10_fmri_string = set([('pkg:/[email protected]', 'test/fat', 'set name=pkg.fmri value=pkg://test/[email protected],5.11-0:')])
62b6033670e4 10416 server catalog v1 support desired
Shawn Walker <srw@sun.com>
parents: 1423
diff changeset
   309
62b6033670e4 10416 server catalog v1 support desired
Shawn Walker <srw@sun.com>
parents: 1423
diff changeset
   310
        res_remote_fat10_star = fat_10_fmri_string | res_fat10_sparc | res_fat10_i386
1127
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
   311
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
   312
        res_local_fat10_i386_star = res_fat10_i386.union(set([
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
   313
            ('pkg:/[email protected]', 'sparc', 'set name=variant.arch value=sparc value=i386')
1431
62b6033670e4 10416 server catalog v1 support desired
Shawn Walker <srw@sun.com>
parents: 1423
diff changeset
   314
        ])).union(fat_10_fmri_string)
1127
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
   315
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
   316
        res_local_fat10_sparc_star = res_fat10_sparc.union(set([
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
   317
            ('pkg:/[email protected]', 'i386', 'set name=variant.arch value=sparc value=i386')
1431
62b6033670e4 10416 server catalog v1 support desired
Shawn Walker <srw@sun.com>
parents: 1423
diff changeset
   318
        ])).union(fat_10_fmri_string)
62b6033670e4 10416 server catalog v1 support desired
Shawn Walker <srw@sun.com>
parents: 1423
diff changeset
   319
941
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
   320
        res_space_with_star = set([
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
   321
            ('pkg:/[email protected]', 'basename', 'file 820157a2043e3135f342b238129b556aade20347 chash=bfa46fc98d1ca97f1260090797d35a35e76096a3 group=sys mode=0444 owner=nobody path="unique/with a space" pkg.csize=38 pkg.size=18')
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
   322
        ])
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
   323
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
   324
        res_space_space_star = set([
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
   325
            ('pkg:/[email protected]', 'basename', 'file 820157a2043e3135f342b238129b556aade20347 chash=bfa46fc98d1ca97f1260090797d35a35e76096a3 group=sys mode=0444 owner=nobody path="unique/with a space" pkg.csize=38 pkg.size=18'), ('pkg:/[email protected]', 'path', 'file 820157a2043e3135f342b238129b556aade20347 chash=bfa46fc98d1ca97f1260090797d35a35e76096a3 group=sys mode=0444 owner=nobody path="unique/with a space" pkg.csize=38 pkg.size=18')
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
   326
        ])
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
   327
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
   328
        res_space_unique = set([
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
   329
            ('pkg:/[email protected]', 'basename', 'dir group=bin mode=0755 owner=root path=unique_dir')
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
   330
        ])
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
   331
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
   332
        misc_files = ['/tmp/example_file']
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
   333
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
   334
        # This is a copy of the 3.81%2C5.11-0.89%3A20080527T163123Z version of
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
   335
        # SUNWgmake from ipkg with the file and liscense actions changed so
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
   336
        # that they all take /tmp/example file when sending.
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
   337
        bug_983_manifest = """
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
   338
open [email protected],5.11-0.89
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
   339
add dir group=sys mode=0755 owner=root path=usr
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
   340
add dir group=bin mode=0755 owner=root path=usr/bin
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
   341
add dir group=bin mode=0755 owner=root path=usr/gnu
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
   342
add dir group=bin mode=0755 owner=root path=usr/gnu/bin
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
   343
add link path=usr/gnu/bin/make target=../../bin/gmake
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
   344
add dir group=sys mode=0755 owner=root path=usr/gnu/share
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
   345
add dir group=bin mode=0755 owner=root path=usr/gnu/share/man
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
   346
add dir group=bin mode=0755 owner=root path=usr/gnu/share/man/man1
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
   347
add link path=usr/gnu/share/man/man1/make.1 target=../../../../share/man/man1/gmake.1
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
   348
add dir group=bin mode=0755 owner=root path=usr/sfw
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
   349
add dir group=bin mode=0755 owner=root path=usr/sfw/bin
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
   350
add link path=usr/sfw/bin/gmake target=../../bin/gmake
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
   351
add dir group=bin mode=0755 owner=root path=usr/sfw/share
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
   352
add dir group=bin mode=0755 owner=root path=usr/sfw/share/man
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
   353
add dir group=bin mode=0755 owner=root path=usr/sfw/share/man/man1
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
   354
add link path=usr/sfw/share/man/man1/gmake.1 target=../../../../share/man/man1/gmake.1
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
   355
add dir group=sys mode=0755 owner=root path=usr/share
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
   356
add dir group=bin mode=0755 owner=root path=usr/share/info
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
   357
add dir group=bin mode=0755 owner=root path=usr/share/man
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
   358
add dir group=bin mode=0755 owner=root path=usr/share/man/man1
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
   359
add file /tmp/example_file elfarch=i386 elfbits=32 elfhash=68cca393e816e6adcbac1e8ffe9c618de70413e0 group=bin mode=0555 owner=root path=usr/bin/gmake pkg.size=18
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
   360
add file /tmp/example_file group=bin mode=0444 owner=root path=usr/share/info/make.info pkg.size=18
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
   361
add file /tmp/example_file group=bin mode=0444 owner=root path=usr/share/info/make.info-1 pkg.size=18
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
   362
add file /tmp/example_file group=bin mode=0444 owner=root path=usr/share/info/make.info-2 pkg.size=18
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
   363
add file /tmp/example_file group=bin mode=0444 owner=root path=usr/share/man/man1/gmake.1 pkg.size=18
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
   364
add license /tmp/example_file license=SUNWgmake.copyright pkg.size=18 transaction_id=1211931083_pkg%3A%2FSUNWgmake%403.81%2C5.11-0.89%3A20080527T163123Z
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
   365
add depend fmri=pkg:/[email protected] type=require
1146
7c10e9798405 3322 'depend' search index has a syntax all its own
Brock Pytlik <bpytlik@sun.com>
parents: 1141
diff changeset
   366
add depend [email protected] type=require
7c10e9798405 3322 'depend' search index has a syntax all its own
Brock Pytlik <bpytlik@sun.com>
parents: 1141
diff changeset
   367
add depend [email protected] type=incorporate
941
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
   368
add set name=description value="gmake - GNU make"
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
   369
add legacy arch=i386 category=system desc="GNU make - A utility used to build software (gmake) 3.81" hotline="Please contact your local service provider" name="gmake - GNU make" pkg=SUNWgmake vendor="Sun Microsystems, Inc." version=11.11.0,REV=2008.04.29.02.08
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
   370
close
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
   371
"""
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
   372
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
   373
        res_bug_983 = set([
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
   374
            ("pkg:/[email protected]", "basename", "link path=usr/sfw/bin/gmake target=../../bin/gmake"),
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
   375
            ('pkg:/[email protected]', 'basename', 'file 820157a2043e3135f342b238129b556aade20347 chash=bfa46fc98d1ca97f1260090797d35a35e76096a3 elfarch=i386 elfbits=32 elfhash=68cca393e816e6adcbac1e8ffe9c618de70413e0 group=bin mode=0555 owner=root path=usr/bin/gmake pkg.csize=38 pkg.size=18'),
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
   376
            ('pkg:/[email protected]', 'gmake', 'set name=description value="gmake - GNU make"')
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
   377
        ])
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
   378
1146
7c10e9798405 3322 'depend' search index has a syntax all its own
Brock Pytlik <bpytlik@sun.com>
parents: 1141
diff changeset
   379
        res_983_csl_dependency = set([
7c10e9798405 3322 'depend' search index has a syntax all its own
Brock Pytlik <bpytlik@sun.com>
parents: 1141
diff changeset
   380
            ('pkg:/[email protected]', 'require', 'depend fmri=pkg:/[email protected] type=require')
7c10e9798405 3322 'depend' search index has a syntax all its own
Brock Pytlik <bpytlik@sun.com>
parents: 1141
diff changeset
   381
        ])
7c10e9798405 3322 'depend' search index has a syntax all its own
Brock Pytlik <bpytlik@sun.com>
parents: 1141
diff changeset
   382
7c10e9798405 3322 'depend' search index has a syntax all its own
Brock Pytlik <bpytlik@sun.com>
parents: 1141
diff changeset
   383
        res_983_bar_dependency = set([
7c10e9798405 3322 'depend' search index has a syntax all its own
Brock Pytlik <bpytlik@sun.com>
parents: 1141
diff changeset
   384
            ('pkg:/[email protected]', 'require', 'depend [email protected] type=require')
7c10e9798405 3322 'depend' search index has a syntax all its own
Brock Pytlik <bpytlik@sun.com>
parents: 1141
diff changeset
   385
        ])
7c10e9798405 3322 'depend' search index has a syntax all its own
Brock Pytlik <bpytlik@sun.com>
parents: 1141
diff changeset
   386
7c10e9798405 3322 'depend' search index has a syntax all its own
Brock Pytlik <bpytlik@sun.com>
parents: 1141
diff changeset
   387
        res_983_foo_dependency = set([
7c10e9798405 3322 'depend' search index has a syntax all its own
Brock Pytlik <bpytlik@sun.com>
parents: 1141
diff changeset
   388
            ('pkg:/[email protected]', 'incorporate', 'depend [email protected] type=incorporate')
7c10e9798405 3322 'depend' search index has a syntax all its own
Brock Pytlik <bpytlik@sun.com>
parents: 1141
diff changeset
   389
        ])
7c10e9798405 3322 'depend' search index has a syntax all its own
Brock Pytlik <bpytlik@sun.com>
parents: 1141
diff changeset
   390
1127
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
   391
        res_local_pkg_ret_pkg = set([
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
   392
            "pkg:/[email protected]"
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
   393
        ])
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
   394
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
   395
        res_remote_pkg_ret_pkg = set([
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
   396
            "pkg:/[email protected]"
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
   397
        ])
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
   398
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
   399
        res_remote_file = set([
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
   400
            ('pkg:/[email protected]',
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
   401
             'path',
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
   402
             'file 820157a2043e3135f342b238129b556aade20347 chash=bfa46fc98d1ca97f1260090797d35a35e76096a3 group=bin mode=0555 owner=root path=bin/example_path pkg.csize=38 pkg.size=18'),
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
   403
            ('pkg:/[email protected]',
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
   404
             '820157a2043e3135f342b238129b556aade20347',
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
   405
             'file 820157a2043e3135f342b238129b556aade20347 chash=bfa46fc98d1ca97f1260090797d35a35e76096a3 group=bin mode=0555 owner=root path=bin/example_path pkg.csize=38 pkg.size=18')
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
   406
        ]) | res_remote_path
1431
62b6033670e4 10416 server catalog v1 support desired
Shawn Walker <srw@sun.com>
parents: 1423
diff changeset
   407
1127
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
   408
        res_remote_url = set([
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
   409
            ('pkg:/[email protected]',
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
   410
            'http://service.opensolaris.com/xml/pkg/[email protected],5.11-1:20080514I120000Z',
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
   411
            'set name=com.sun.service.info_url value=http://service.opensolaris.com/xml/pkg/[email protected],5.11-1:20080514I120000Z')
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
   412
        ])
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
   413
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
   414
        res_remote_path_extra = set([
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
   415
            ('pkg:/[email protected]',
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
   416
             'basename',
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
   417
             'file 820157a2043e3135f342b238129b556aade20347 chash=bfa46fc98d1ca97f1260090797d35a35e76096a3 group=bin mode=0555 owner=root path=bin/example_path pkg.csize=38 pkg.size=18'),
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
   418
            ('pkg:/[email protected]',
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
   419
             'path',
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
   420
             'file 820157a2043e3135f342b238129b556aade20347 chash=bfa46fc98d1ca97f1260090797d35a35e76096a3 group=bin mode=0555 owner=root path=bin/example_path pkg.csize=38 pkg.size=18'),
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
   421
            ('pkg:/[email protected]',
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
   422
             '820157a2043e3135f342b238129b556aade20347',
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
   423
             'file 820157a2043e3135f342b238129b556aade20347 chash=bfa46fc98d1ca97f1260090797d35a35e76096a3 group=bin mode=0555 owner=root path=bin/example_path pkg.csize=38 pkg.size=18')
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
   424
        ])
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
   425
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
   426
        res_bad_pkg = set([
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
   427
            ('pkg:/[email protected]', 'basename',
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
   428
             'dir group=bin mode=0755 owner=root path=badfoo/')
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
   429
        ])
1354
22d755acef3d 11104 fast add not being cleared correctly
Brock Pytlik <bpytlik@sun.com>
parents: 1352
diff changeset
   430
22d755acef3d 11104 fast add not being cleared correctly
Brock Pytlik <bpytlik@sun.com>
parents: 1352
diff changeset
   431
        fast_add_after_install = set([
22d755acef3d 11104 fast add not being cleared correctly
Brock Pytlik <bpytlik@sun.com>
parents: 1352
diff changeset
   432
            "VERSION: 2\n",
22d755acef3d 11104 fast add not being cleared correctly
Brock Pytlik <bpytlik@sun.com>
parents: 1352
diff changeset
   433
            "[email protected],5.11",
22d755acef3d 11104 fast add not being cleared correctly
Brock Pytlik <bpytlik@sun.com>
parents: 1352
diff changeset
   434
            "[email protected],5.11"
22d755acef3d 11104 fast add not being cleared correctly
Brock Pytlik <bpytlik@sun.com>
parents: 1352
diff changeset
   435
        ])
22d755acef3d 11104 fast add not being cleared correctly
Brock Pytlik <bpytlik@sun.com>
parents: 1352
diff changeset
   436
22d755acef3d 11104 fast add not being cleared correctly
Brock Pytlik <bpytlik@sun.com>
parents: 1352
diff changeset
   437
        fast_remove_after_install = set([
22d755acef3d 11104 fast add not being cleared correctly
Brock Pytlik <bpytlik@sun.com>
parents: 1352
diff changeset
   438
            "VERSION: 2\n",
22d755acef3d 11104 fast add not being cleared correctly
Brock Pytlik <bpytlik@sun.com>
parents: 1352
diff changeset
   439
        ])
22d755acef3d 11104 fast add not being cleared correctly
Brock Pytlik <bpytlik@sun.com>
parents: 1352
diff changeset
   440
22d755acef3d 11104 fast add not being cleared correctly
Brock Pytlik <bpytlik@sun.com>
parents: 1352
diff changeset
   441
        fast_add_after_first_update = set([
22d755acef3d 11104 fast add not being cleared correctly
Brock Pytlik <bpytlik@sun.com>
parents: 1352
diff changeset
   442
            "VERSION: 2\n",
22d755acef3d 11104 fast add not being cleared correctly
Brock Pytlik <bpytlik@sun.com>
parents: 1352
diff changeset
   443
            "[email protected],5.11",
22d755acef3d 11104 fast add not being cleared correctly
Brock Pytlik <bpytlik@sun.com>
parents: 1352
diff changeset
   444
            "[email protected],5.11",
22d755acef3d 11104 fast add not being cleared correctly
Brock Pytlik <bpytlik@sun.com>
parents: 1352
diff changeset
   445
            "[email protected],5.11",
22d755acef3d 11104 fast add not being cleared correctly
Brock Pytlik <bpytlik@sun.com>
parents: 1352
diff changeset
   446
            "[email protected],5.11"
22d755acef3d 11104 fast add not being cleared correctly
Brock Pytlik <bpytlik@sun.com>
parents: 1352
diff changeset
   447
        ])
22d755acef3d 11104 fast add not being cleared correctly
Brock Pytlik <bpytlik@sun.com>
parents: 1352
diff changeset
   448
22d755acef3d 11104 fast add not being cleared correctly
Brock Pytlik <bpytlik@sun.com>
parents: 1352
diff changeset
   449
        fast_remove_after_first_update = set([
22d755acef3d 11104 fast add not being cleared correctly
Brock Pytlik <bpytlik@sun.com>
parents: 1352
diff changeset
   450
            "VERSION: 2\n",
22d755acef3d 11104 fast add not being cleared correctly
Brock Pytlik <bpytlik@sun.com>
parents: 1352
diff changeset
   451
            "[email protected],5.11",
22d755acef3d 11104 fast add not being cleared correctly
Brock Pytlik <bpytlik@sun.com>
parents: 1352
diff changeset
   452
            "[email protected],5.11"
22d755acef3d 11104 fast add not being cleared correctly
Brock Pytlik <bpytlik@sun.com>
parents: 1352
diff changeset
   453
        ])
22d755acef3d 11104 fast add not being cleared correctly
Brock Pytlik <bpytlik@sun.com>
parents: 1352
diff changeset
   454
22d755acef3d 11104 fast add not being cleared correctly
Brock Pytlik <bpytlik@sun.com>
parents: 1352
diff changeset
   455
        fast_add_after_second_update = set(["VERSION: 2\n"])
22d755acef3d 11104 fast add not being cleared correctly
Brock Pytlik <bpytlik@sun.com>
parents: 1352
diff changeset
   456
22d755acef3d 11104 fast add not being cleared correctly
Brock Pytlik <bpytlik@sun.com>
parents: 1352
diff changeset
   457
        fast_remove_after_second_update = set(["VERSION: 2\n"])
1431
62b6033670e4 10416 server catalog v1 support desired
Shawn Walker <srw@sun.com>
parents: 1423
diff changeset
   458
62b6033670e4 10416 server catalog v1 support desired
Shawn Walker <srw@sun.com>
parents: 1423
diff changeset
   459
        debug_features = []
941
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
   460
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
   461
        def setUp(self):
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
   462
                for p in self.misc_files:
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
   463
                        f = open(p, "w")
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
   464
                        # Write the name of the file into the file, so that
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
   465
                        # all files have differing contents.
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
   466
                        f.write(p + "\n")
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
   467
                        f.close()
1081
0cc3e524ea7f 8318 search v1 not sending uuid
Brock Pytlik <bpytlik@sun.com>
parents: 1054
diff changeset
   468
                testutils.SingleDepotTestCase.setUp(self,
1127
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
   469
                    debug_features=self.debug_features)
941
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
   470
                tp = self.get_test_prefix()
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
   471
                self.testdata_dir = os.path.join(tp, "search_results")
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
   472
                os.mkdir(self.testdata_dir)
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
   473
                self._dir_restore_functions = [self._restore_dir,
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
   474
                    self._restore_dir_preserve_hash]
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
   475
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
   476
        def tearDown(self):
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
   477
                testutils.SingleDepotTestCase.tearDown(self)
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
   478
                for p in self.misc_files:
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
   479
                        os.remove(p)
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
   480
                shutil.rmtree(self.testdata_dir)
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
   481
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
   482
        def _check(self, proposed_answer, correct_answer):
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
   483
                if correct_answer == proposed_answer:
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
   484
                        return True
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
   485
                else:
1352
5c92c9d342ef 11065 client v1 catalog support for v0 catalogs
Shawn Walker <srw@sun.com>
parents: 1325
diff changeset
   486
                        self.debug("Proposed Answer: " + str(proposed_answer))
5c92c9d342ef 11065 client v1 catalog support for v0 catalogs
Shawn Walker <srw@sun.com>
parents: 1325
diff changeset
   487
                        self.debug("Correct Answer : " + str(correct_answer))
941
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
   488
                        if isinstance(correct_answer, set) and \
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
   489
                            isinstance(proposed_answer, set):
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
   490
                                print >> sys.stderr, "Missing: " + \
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
   491
                                    str(correct_answer - proposed_answer)
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
   492
                                print >> sys.stderr, "Extra  : " + \
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
   493
                                    str(proposed_answer - correct_answer)
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
   494
                        self.assert_(correct_answer == proposed_answer)
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
   495
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
   496
        @staticmethod
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
   497
        def _replace_act(act):
1431
62b6033670e4 10416 server catalog v1 support desired
Shawn Walker <srw@sun.com>
parents: 1423
diff changeset
   498
                if act.startswith('set name=pkg.fmri'):
1325
0cb607b76761 10690 package installed from non-preferred pub include pub prefix in name token
Brock Pytlik <bpytlik@sun.com>
parents: 1291
diff changeset
   499
                        return act.strip().rsplit(":", 1)[0] + ":"
941
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
   500
                else:
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
   501
                        return act.strip()
1431
62b6033670e4 10416 server catalog v1 support desired
Shawn Walker <srw@sun.com>
parents: 1423
diff changeset
   502
941
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
   503
        @staticmethod
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
   504
        def _extract_action_from_res(it):
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
   505
                return (
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
   506
                    (fmri.PkgFmri(str(pkg_name)).get_short_fmri(), piece,
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
   507
                    TestApiSearchBasics._replace_act(act))
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
   508
                    for query_num, auth, (version, return_type,
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
   509
                    (pkg_name, piece, act))
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
   510
                    in it
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
   511
                )
1127
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
   512
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
   513
        @staticmethod
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
   514
        def _extract_package_from_res(it):
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
   515
                return (
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
   516
                    (fmri.PkgFmri(str(pkg_name)).get_short_fmri())
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
   517
                    for query_num, auth, (version, return_type, pkg_name)
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
   518
                    in it
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
   519
                )
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
   520
1354
22d755acef3d 11104 fast add not being cleared correctly
Brock Pytlik <bpytlik@sun.com>
parents: 1352
diff changeset
   521
        @staticmethod
22d755acef3d 11104 fast add not being cleared correctly
Brock Pytlik <bpytlik@sun.com>
parents: 1352
diff changeset
   522
        def _get_lines(fp):
22d755acef3d 11104 fast add not being cleared correctly
Brock Pytlik <bpytlik@sun.com>
parents: 1352
diff changeset
   523
                fh = open(fp, "rb")
22d755acef3d 11104 fast add not being cleared correctly
Brock Pytlik <bpytlik@sun.com>
parents: 1352
diff changeset
   524
                lines = fh.readlines()
22d755acef3d 11104 fast add not being cleared correctly
Brock Pytlik <bpytlik@sun.com>
parents: 1352
diff changeset
   525
                fh.close()
22d755acef3d 11104 fast add not being cleared correctly
Brock Pytlik <bpytlik@sun.com>
parents: 1352
diff changeset
   526
                return lines
22d755acef3d 11104 fast add not being cleared correctly
Brock Pytlik <bpytlik@sun.com>
parents: 1352
diff changeset
   527
941
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
   528
        def _search_op(self, api_obj, remote, token, test_value,
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
   529
            case_sensitive=False, return_actions=True, num_to_return=None,
1081
0cc3e524ea7f 8318 search v1 not sending uuid
Brock Pytlik <bpytlik@sun.com>
parents: 1054
diff changeset
   530
            start_point=None, servers=None):
1360
fbf184c6d55b 1059 search both original input and paths with image root removed
Brock Pytlik <bpytlik@sun.com>
parents: 1354
diff changeset
   531
                query = [api.Query(token, case_sensitive, return_actions,
fbf184c6d55b 1059 search both original input and paths with image root removed
Brock Pytlik <bpytlik@sun.com>
parents: 1354
diff changeset
   532
                    num_to_return, start_point)]
fbf184c6d55b 1059 search both original input and paths with image root removed
Brock Pytlik <bpytlik@sun.com>
parents: 1354
diff changeset
   533
                self._search_op_common(api_obj, remote, query, test_value,
fbf184c6d55b 1059 search both original input and paths with image root removed
Brock Pytlik <bpytlik@sun.com>
parents: 1354
diff changeset
   534
                    return_actions, servers)
fbf184c6d55b 1059 search both original input and paths with image root removed
Brock Pytlik <bpytlik@sun.com>
parents: 1354
diff changeset
   535
fbf184c6d55b 1059 search both original input and paths with image root removed
Brock Pytlik <bpytlik@sun.com>
parents: 1354
diff changeset
   536
        def _search_op_multi(self, api_obj, remote, tokens, test_value,
fbf184c6d55b 1059 search both original input and paths with image root removed
Brock Pytlik <bpytlik@sun.com>
parents: 1354
diff changeset
   537
            case_sensitive=False, return_actions=True, num_to_return=None,
fbf184c6d55b 1059 search both original input and paths with image root removed
Brock Pytlik <bpytlik@sun.com>
parents: 1354
diff changeset
   538
            start_point=None, servers=None):
fbf184c6d55b 1059 search both original input and paths with image root removed
Brock Pytlik <bpytlik@sun.com>
parents: 1354
diff changeset
   539
                query = [api.Query(token, case_sensitive, return_actions,
fbf184c6d55b 1059 search both original input and paths with image root removed
Brock Pytlik <bpytlik@sun.com>
parents: 1354
diff changeset
   540
                    num_to_return, start_point) for token in tokens]
fbf184c6d55b 1059 search both original input and paths with image root removed
Brock Pytlik <bpytlik@sun.com>
parents: 1354
diff changeset
   541
                self._search_op_common(api_obj, remote, query, test_value,
fbf184c6d55b 1059 search both original input and paths with image root removed
Brock Pytlik <bpytlik@sun.com>
parents: 1354
diff changeset
   542
                    return_actions, servers)
fbf184c6d55b 1059 search both original input and paths with image root removed
Brock Pytlik <bpytlik@sun.com>
parents: 1354
diff changeset
   543
fbf184c6d55b 1059 search both original input and paths with image root removed
Brock Pytlik <bpytlik@sun.com>
parents: 1354
diff changeset
   544
        def _search_op_common(self, api_obj, remote, query, test_value,
fbf184c6d55b 1059 search both original input and paths with image root removed
Brock Pytlik <bpytlik@sun.com>
parents: 1354
diff changeset
   545
            return_actions, servers):
941
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
   546
                search_func = api_obj.local_search
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
   547
                if remote:
1081
0cc3e524ea7f 8318 search v1 not sending uuid
Brock Pytlik <bpytlik@sun.com>
parents: 1054
diff changeset
   548
                        search_func = lambda x: api_obj.remote_search(x,
0cc3e524ea7f 8318 search v1 not sending uuid
Brock Pytlik <bpytlik@sun.com>
parents: 1054
diff changeset
   549
                            servers=servers)
1360
fbf184c6d55b 1059 search both original input and paths with image root removed
Brock Pytlik <bpytlik@sun.com>
parents: 1354
diff changeset
   550
                res = search_func(query)
1127
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
   551
                if return_actions:
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
   552
                        res = self._extract_action_from_res(res)
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
   553
                else:
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
   554
                        res = self._extract_package_from_res(res)
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
   555
                res = set(res)
941
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
   556
                self._check(set(res), test_value)
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
   557
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
   558
        def _search_op_slow(self, api_obj, remote, token, test_value,
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
   559
            case_sensitive=False, return_actions=True, num_to_return=None,
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
   560
            start_point=None):
1360
fbf184c6d55b 1059 search both original input and paths with image root removed
Brock Pytlik <bpytlik@sun.com>
parents: 1354
diff changeset
   561
                query = [api.Query(token, case_sensitive, return_actions,
fbf184c6d55b 1059 search both original input and paths with image root removed
Brock Pytlik <bpytlik@sun.com>
parents: 1354
diff changeset
   562
                    num_to_return, start_point)]
fbf184c6d55b 1059 search both original input and paths with image root removed
Brock Pytlik <bpytlik@sun.com>
parents: 1354
diff changeset
   563
                self._search_op_slow_common(api_obj, query, test_value,
fbf184c6d55b 1059 search both original input and paths with image root removed
Brock Pytlik <bpytlik@sun.com>
parents: 1354
diff changeset
   564
                    return_actions)
fbf184c6d55b 1059 search both original input and paths with image root removed
Brock Pytlik <bpytlik@sun.com>
parents: 1354
diff changeset
   565
fbf184c6d55b 1059 search both original input and paths with image root removed
Brock Pytlik <bpytlik@sun.com>
parents: 1354
diff changeset
   566
        def _search_op_slow_multi(self, api_obj, remote, tokens, test_value,
fbf184c6d55b 1059 search both original input and paths with image root removed
Brock Pytlik <bpytlik@sun.com>
parents: 1354
diff changeset
   567
            case_sensitive=False, return_actions=True, num_to_return=None,
fbf184c6d55b 1059 search both original input and paths with image root removed
Brock Pytlik <bpytlik@sun.com>
parents: 1354
diff changeset
   568
            start_point=None):
fbf184c6d55b 1059 search both original input and paths with image root removed
Brock Pytlik <bpytlik@sun.com>
parents: 1354
diff changeset
   569
                query = [api.Query(token, case_sensitive, return_actions,
fbf184c6d55b 1059 search both original input and paths with image root removed
Brock Pytlik <bpytlik@sun.com>
parents: 1354
diff changeset
   570
                    num_to_return, start_point) for token in tokens]
fbf184c6d55b 1059 search both original input and paths with image root removed
Brock Pytlik <bpytlik@sun.com>
parents: 1354
diff changeset
   571
                self._search_op_slow_common(api_obj, query, test_value,
fbf184c6d55b 1059 search both original input and paths with image root removed
Brock Pytlik <bpytlik@sun.com>
parents: 1354
diff changeset
   572
                    return_actions)
fbf184c6d55b 1059 search both original input and paths with image root removed
Brock Pytlik <bpytlik@sun.com>
parents: 1354
diff changeset
   573
fbf184c6d55b 1059 search both original input and paths with image root removed
Brock Pytlik <bpytlik@sun.com>
parents: 1354
diff changeset
   574
        def _search_op_slow_common(self, api_obj, query, test_value,
fbf184c6d55b 1059 search both original input and paths with image root removed
Brock Pytlik <bpytlik@sun.com>
parents: 1354
diff changeset
   575
            return_actions):
941
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
   576
                search_func = api_obj.local_search
1360
fbf184c6d55b 1059 search both original input and paths with image root removed
Brock Pytlik <bpytlik@sun.com>
parents: 1354
diff changeset
   577
                tmp = search_func(query)
941
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
   578
                res = []
1127
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
   579
                ssu = False
941
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
   580
                try:
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
   581
                        for i in tmp:
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
   582
                                res.append(i)
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
   583
                except api_errors.SlowSearchUsed:
1127
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
   584
                        ssu = True
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
   585
                self.assert_(ssu)
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
   586
                if return_actions:
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
   587
                        res = self._extract_action_from_res(res)
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
   588
                else:
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
   589
                        res = self._extract_package_from_res(res)
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
   590
                res = set(res)
941
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
   591
                self._check(set(res), test_value)
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
   592
1127
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
   593
        def _run_full_remote_tests(self, api_obj):
1431
62b6033670e4 10416 server catalog v1 support desired
Shawn Walker <srw@sun.com>
parents: 1423
diff changeset
   594
                self._search_op(api_obj, True, "example_pkg",
62b6033670e4 10416 server catalog v1 support desired
Shawn Walker <srw@sun.com>
parents: 1423
diff changeset
   595
                    self.res_remote_pkg)
941
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
   596
                self._search_op(api_obj, True, "example_path",
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
   597
                    self.res_remote_path)
1127
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
   598
                self._search_op(api_obj, True, "(example_path)",
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
   599
                    self.res_remote_path)
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
   600
                self._search_op(api_obj, True, "<exam*:::>",
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
   601
                    self.res_remote_pkg_ret_pkg, return_actions=False)
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
   602
                self._search_op(api_obj, True, "::com.sun.service.info_url:",
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
   603
                    self.res_remote_url)
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
   604
                self._search_op(api_obj, True, ":::e* AND *path",
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
   605
                    self.res_remote_path)
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
   606
                self._search_op(api_obj, True, "e* AND *path",
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
   607
                    self.res_remote_path)
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
   608
                self._search_op(api_obj, True, "<e*>",
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
   609
                    self.res_remote_pkg_ret_pkg, return_actions=False)
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
   610
                self._search_op(api_obj, True, "<e*> AND <e*>",
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
   611
                    self.res_remote_pkg_ret_pkg, return_actions=False)
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
   612
                self._search_op(api_obj, True, "<e*> OR <e*>",
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
   613
                    self.res_remote_pkg_ret_pkg, return_actions=False)
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
   614
                self._search_op(api_obj, True, "<exam:::>",
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
   615
                    self.res_remote_pkg_ret_pkg, return_actions=False)
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
   616
                self._search_op(api_obj, True, "exam:::e*path",
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
   617
                    self.res_remote_path)
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
   618
                self._search_op(api_obj, True, "exam:::e*path AND e*:::",
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
   619
                    self.res_remote_path)
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
   620
                self._search_op(api_obj, True, "e*::: AND exam:::*path",
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
   621
                    self.res_remote_path_extra)
941
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
   622
                self._search_op(api_obj, True, "example*",
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
   623
                    self.res_remote_wildcard)
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
   624
                self._search_op(api_obj, True, "/bin", self.res_remote_bin)
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
   625
                self._search_op(api_obj, True, "4851433",
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
   626
                    self.res_remote_bug_id)
1127
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
   627
                self._search_op(api_obj, True, "<4851433> AND <4725245>",
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
   628
                    self.res_remote_pkg_ret_pkg, return_actions=False)
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
   629
                self._search_op(api_obj, True, "4851433 AND 4725245",
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
   630
                    self.res_remote_bug_id)
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
   631
                self._search_op(api_obj, True,
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
   632
                    "4851433 AND 4725245 OR example_path",
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
   633
                    self.res_remote_bug_id)
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
   634
                self._search_op(api_obj, True,
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
   635
                    "4851433 AND (4725245 OR example_path)",
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
   636
                    self.res_remote_bug_id)
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
   637
                self._search_op(api_obj, True,
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
   638
                    "(4851433 AND 4725245) OR example_path",
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
   639
                    self.res_remote_bug_id | self.res_remote_path)
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
   640
                self._search_op(api_obj, True, "4851433 OR 4725245",
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
   641
                    self.res_remote_bug_id | self.res_remote_bug_id_4725245)
941
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
   642
                self._search_op(api_obj, True, "6556919",
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
   643
                    self.res_remote_inc_changes)
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
   644
                self._search_op(api_obj, True, "6556?19",
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
   645
                    self.res_remote_inc_changes)
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
   646
                self._search_op(api_obj, True, "42",
1127
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
   647
                    self.res_remote_random_test)
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
   648
                self._search_op(api_obj, True, "79",
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
   649
                    self.res_remote_random_test_79)
941
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
   650
                self._search_op(api_obj, True, "separator",
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
   651
                    self.res_remote_keywords)
1127
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
   652
                self._search_op(api_obj, True, "\"sort 0x86\"",
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
   653
                    self.res_remote_keywords_sort_phrase)
941
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
   654
                self._search_op(api_obj, True, "*example*",
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
   655
                    self.res_remote_glob)
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
   656
                self._search_op(api_obj, True, "fooo", self.res_remote_foo)
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
   657
                self._search_op(api_obj, True, "fo*", self.res_remote_foo)
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
   658
                self._search_op(api_obj, True, "bar", self.res_remote_bar)
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
   659
                self._search_op(api_obj, True, "openssl",
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
   660
                    self.res_remote_openssl)
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
   661
                self._search_op(api_obj, True, "OPENSSL",
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
   662
                    self.res_remote_openssl)
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
   663
                self._search_op(api_obj, True, "OpEnSsL",
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
   664
                    self.res_remote_openssl)
1364
adcb4c5ebebd 11235 phrase search should be case insensitive by default
Brock Pytlik <bpytlik@sun.com>
parents: 1360
diff changeset
   665
                # Test for bug 11235, case insensitive phrase search, and bug
adcb4c5ebebd 11235 phrase search should be case insensitive by default
Brock Pytlik <bpytlik@sun.com>
parents: 1360
diff changeset
   666
                # 11354, mangled fields during phrase search.
adcb4c5ebebd 11235 phrase search should be case insensitive by default
Brock Pytlik <bpytlik@sun.com>
parents: 1360
diff changeset
   667
                self._search_op(api_obj, True, "'OpEnSsL'",
adcb4c5ebebd 11235 phrase search should be case insensitive by default
Brock Pytlik <bpytlik@sun.com>
parents: 1360
diff changeset
   668
                    self.res_remote_openssl)
941
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
   669
                self._search_op(api_obj, True, "OpEnS*",
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
   670
                    self.res_remote_openssl)
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
   671
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
   672
                # These tests are included because a specific bug
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
   673
                # was found during development. This prevents regression back
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
   674
                # to that bug. Exit status of 1 is expected because the
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
   675
                # token isn't in the packages.
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
   676
                self._search_op(api_obj, True, "a_non_existent_token", set())
1127
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
   677
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
   678
                self._search_op(api_obj, True, "42 AND 4641790", set())
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
   679
                self.assertRaises(api_errors.BooleanQueryException,
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
   680
                    self._search_op, api_obj, True, "<e*> AND e*", set())
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
   681
                self.assertRaises(api_errors.BooleanQueryException,
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
   682
                    self._search_op, api_obj, True, "e* AND <e*>", set())
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
   683
                self.assertRaises(api_errors.BooleanQueryException,
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
   684
                    self._search_op, api_obj, True, "<e*> OR e*", set())
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
   685
                self.assertRaises(api_errors.BooleanQueryException,
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
   686
                    self._search_op, api_obj, True, "e* OR <e*>", set())
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
   687
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
   688
        def _run_remote_tests(self, api_obj):
1431
62b6033670e4 10416 server catalog v1 support desired
Shawn Walker <srw@sun.com>
parents: 1423
diff changeset
   689
                self._search_op(api_obj, True, "example_pkg",
62b6033670e4 10416 server catalog v1 support desired
Shawn Walker <srw@sun.com>
parents: 1423
diff changeset
   690
                    self.res_remote_pkg)
1127
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
   691
                self._search_op(api_obj, True, "example_path",
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
   692
                    self.res_remote_path)
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
   693
                self._search_op(api_obj, True, "::com.sun.service.info_url:",
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
   694
                    self.res_remote_url)
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
   695
                self._search_op(api_obj, True, "<e*>",
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
   696
                    self.res_remote_pkg_ret_pkg, return_actions=False)
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
   697
                self._search_op(api_obj, True, "<exam:::>",
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
   698
                    self.res_remote_pkg_ret_pkg, return_actions=False)
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
   699
                self._search_op(api_obj, True, "exam:::e*path",
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
   700
                    self.res_remote_path)
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
   701
                self._search_op(api_obj, True, "example*",
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
   702
                    self.res_remote_wildcard)
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
   703
                self._search_op(api_obj, True, "/bin", self.res_remote_bin)
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
   704
                self._search_op(api_obj, True, "4851433",
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
   705
                    self.res_remote_bug_id)
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
   706
                self._search_op(api_obj, True, "4725245",
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
   707
                    self.res_remote_bug_id_4725245)
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
   708
                self._search_op(api_obj, True, "6556919",
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
   709
                    self.res_remote_inc_changes)
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
   710
                self._search_op(api_obj, True, "42",
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
   711
                    self.res_remote_random_test)
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
   712
                self._search_op(api_obj, True, "79",
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
   713
                    self.res_remote_random_test_79)
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
   714
                self._search_op(api_obj, True, "separator",
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
   715
                    self.res_remote_keywords)
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
   716
                self._search_op(api_obj, True, "\"sort 0x86\"",
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
   717
                    self.res_remote_keywords_sort_phrase)
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
   718
                self._search_op(api_obj, True, "*example*",
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
   719
                    self.res_remote_glob)
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
   720
                self._search_op(api_obj, True, "fooo", self.res_remote_foo)
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
   721
                self._search_op(api_obj, True, "bar", self.res_remote_bar)
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
   722
                self._search_op(api_obj, True, "OpEnSsL",
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
   723
                    self.res_remote_openssl)
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
   724
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
   725
                # These tests are included because a specific bug
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
   726
                # was found during development. This prevents regression back
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
   727
                # to that bug.
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
   728
                self._search_op(api_obj, True, "a_non_existent_token", set())
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
   729
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
   730
        def _run_full_local_tests(self, api_obj):
941
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
   731
                outfile = os.path.join(self.testdata_dir, "res")
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
   732
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
   733
                # This finds something because the client side
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
   734
                # manifest has had the name of the package inserted
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
   735
                # into it.
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
   736
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
   737
                self._search_op(api_obj, False, "example_pkg",
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
   738
                    self.res_local_pkg)
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
   739
                self._search_op(api_obj, False, "example_path",
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
   740
                    self.res_local_path)
1127
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
   741
                self._search_op(api_obj, False, "(example_path)",
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
   742
                    self.res_local_path)
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
   743
                self._search_op(api_obj, False, "<exam*:::>",
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
   744
                    self.res_local_pkg_ret_pkg, return_actions=False)
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
   745
                self._search_op(api_obj, False, "::com.sun.service.info_url:",
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
   746
                    self.res_remote_url)
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
   747
                self._search_op(api_obj, False, ":::e* AND *path",
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
   748
                    self.res_local_path)
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
   749
                self._search_op(api_obj, False, "e* AND *path",
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
   750
                    self.res_local_path)
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
   751
                self._search_op(api_obj, False, "<e*>",
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
   752
                    self.res_local_pkg_ret_pkg, return_actions=False)
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
   753
                self._search_op(api_obj, False, "<e*> AND <e*>",
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
   754
                    self.res_local_pkg_ret_pkg, return_actions=False)
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
   755
                self._search_op(api_obj, False, "<e*> OR <e*>",
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
   756
                    self.res_local_pkg_ret_pkg, return_actions=False)
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
   757
                self._search_op(api_obj, False, "<exam:::>",
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
   758
                    self.res_local_pkg_ret_pkg, return_actions=False)
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
   759
                self._search_op(api_obj, False, "exam:::e*path",
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
   760
                    self.res_local_path)
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
   761
                self._search_op(api_obj, False, "exam:::e*path AND e*:::",
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
   762
                    self.res_local_path)
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
   763
                self._search_op(api_obj, False, "e*::: AND exam:::*path",
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
   764
                    self.res_remote_path_extra)
941
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
   765
                self._search_op(api_obj, False, "example*",
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
   766
                    self.res_local_wildcard)
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
   767
                self._search_op(api_obj, False, "/bin", self.res_local_bin)
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
   768
                self._search_op(api_obj, False, "4851433",
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
   769
                    self.res_local_bug_id)
1127
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
   770
                self._search_op(api_obj, False, "<4851433> AND <4725245>",
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
   771
                    self.res_local_pkg_ret_pkg, return_actions=False)
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
   772
                self._search_op(api_obj, False, "4851433 AND 4725245",
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
   773
                    self.res_local_bug_id)
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
   774
                self._search_op(api_obj, False,
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
   775
                    "4851433 AND 4725245 OR example_path",
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
   776
                    self.res_local_bug_id)
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
   777
                self._search_op(api_obj, False,
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
   778
                    "4851433 AND (4725245 OR example_path)",
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
   779
                    self.res_local_bug_id)
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
   780
                self._search_op(api_obj, False,
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
   781
                    "(4851433 AND 4725245) OR example_path",
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
   782
                    self.res_local_bug_id | self.res_local_path)
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
   783
                self._search_op(api_obj, False, "4851433 OR 4725245",
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
   784
                    self.res_local_bug_id | self.res_remote_bug_id_4725245)
941
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
   785
                self._search_op(api_obj, False, "6556919",
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
   786
                    self.res_local_inc_changes)
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
   787
                self._search_op(api_obj, False, "65569??",
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
   788
                    self.res_local_inc_changes)
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
   789
                self._search_op(api_obj, False, "42",
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
   790
                    self.res_local_random_test)
1127
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
   791
                self._search_op(api_obj, False, "79",
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
   792
                    self.res_remote_random_test_79)
941
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
   793
                self._search_op(api_obj, False, "separator",
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
   794
                    self.res_local_keywords)
1127
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
   795
                self._search_op(api_obj, False, "\"sort 0x86\"",
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
   796
                    self.res_remote_keywords_sort_phrase)
941
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
   797
                self._search_op(api_obj, False, "*example*",
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
   798
                    self.res_local_glob)
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
   799
                self._search_op(api_obj, False, "fooo", self.res_local_foo)
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
   800
                self._search_op(api_obj, False, "fo*", self.res_local_foo)
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
   801
                self._search_op(api_obj, False, "bar", self.res_local_bar)
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
   802
                self._search_op(api_obj, False, "openssl",
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
   803
                    self.res_local_openssl)
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
   804
                self._search_op(api_obj, False, "OPENSSL",
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
   805
                    self.res_local_openssl)
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
   806
                self._search_op(api_obj, False, "OpEnSsL",
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
   807
                    self.res_local_openssl)
1364
adcb4c5ebebd 11235 phrase search should be case insensitive by default
Brock Pytlik <bpytlik@sun.com>
parents: 1360
diff changeset
   808
                # Test for bug 11235, case insensitive phrase search, and bug
adcb4c5ebebd 11235 phrase search should be case insensitive by default
Brock Pytlik <bpytlik@sun.com>
parents: 1360
diff changeset
   809
                # 11354, mangled fields during phrase search.
adcb4c5ebebd 11235 phrase search should be case insensitive by default
Brock Pytlik <bpytlik@sun.com>
parents: 1360
diff changeset
   810
                self._search_op(api_obj, False, "'OpEnSsL'",
adcb4c5ebebd 11235 phrase search should be case insensitive by default
Brock Pytlik <bpytlik@sun.com>
parents: 1360
diff changeset
   811
                    self.res_remote_openssl)
941
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
   812
                self._search_op(api_obj, False, "OpEnS*",
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
   813
                    self.res_local_openssl)
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
   814
                # These tests are included because a specific bug
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
   815
                # was found during development. These tests prevent regression
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
   816
                # back to that bug. Exit status of 1 is expected because the
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
   817
                # token isn't in the packages.
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
   818
                self._search_op(api_obj, False, "a_non_existent_token", set())
1127
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
   819
                self._search_op(api_obj, False, "42 AND 4641790", set())
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
   820
                self.assertRaises(api_errors.BooleanQueryException,
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
   821
                    self._search_op, api_obj, False, "<e*> AND e*", set())
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
   822
                self.assertRaises(api_errors.BooleanQueryException,
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
   823
                    self._search_op, api_obj, False, "e* AND <e*>", set())
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
   824
                self.assertRaises(api_errors.BooleanQueryException,
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
   825
                    self._search_op, api_obj, False, "<e*> OR e*", set())
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
   826
                self.assertRaises(api_errors.BooleanQueryException,
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
   827
                    self._search_op, api_obj, False, "e* OR <e*>", set())
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
   828
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
   829
        def _run_local_tests(self, api_obj):
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
   830
                outfile = os.path.join(self.testdata_dir, "res")
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
   831
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
   832
                # This finds something because the client side
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
   833
                # manifest has had the name of the package inserted
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
   834
                # into it.
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
   835
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
   836
                self._search_op(api_obj, False, "example_pkg",
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
   837
                    self.res_local_pkg)
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
   838
                self._search_op(api_obj, False, "example_path",
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
   839
                    self.res_local_path)
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
   840
                self._search_op(api_obj, False, "::com.sun.service.info_url:",
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
   841
                    self.res_remote_url)
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
   842
                self._search_op(api_obj, False, "<e*>",
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
   843
                    self.res_local_pkg_ret_pkg, return_actions=False)
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
   844
                self._search_op(api_obj, False, "<exam:::>",
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
   845
                    self.res_local_pkg_ret_pkg, return_actions=False)
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
   846
                self._search_op(api_obj, False, "exam:::e*path",
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
   847
                    self.res_local_path)
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
   848
                self._search_op(api_obj, False, "example*",
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
   849
                    self.res_local_wildcard)
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
   850
                self._search_op(api_obj, False, "/bin", self.res_local_bin)
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
   851
                self._search_op(api_obj, False, "4851433",
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
   852
                    self.res_local_bug_id)
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
   853
                self._search_op(api_obj, False, "4725245",
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
   854
                    self.res_remote_bug_id_4725245)
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
   855
                self._search_op(api_obj, False, "6556919",
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
   856
                    self.res_local_inc_changes)
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
   857
                self._search_op(api_obj, False, "42",
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
   858
                    self.res_local_random_test)
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
   859
                self._search_op(api_obj, False, "79",
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
   860
                    self.res_remote_random_test_79)
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
   861
                self._search_op(api_obj, False, "separator",
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
   862
                    self.res_local_keywords)
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
   863
                self._search_op(api_obj, False, "\"sort 0x86\"",
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
   864
                    self.res_remote_keywords_sort_phrase)
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
   865
                self._search_op(api_obj, False, "*example*",
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
   866
                    self.res_local_glob)
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
   867
                self._search_op(api_obj, False, "fooo", self.res_local_foo)
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
   868
                self._search_op(api_obj, False, "bar", self.res_local_bar)
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
   869
                self._search_op(api_obj, False, "OpEnSsL",
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
   870
                    self.res_local_openssl)
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
   871
                # These tests are included because a specific bug
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
   872
                # was found during development. These tests prevent regression
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
   873
                # back to that bug.
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
   874
                self._search_op(api_obj, False, "a_non_existent_token", set())
941
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
   875
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
   876
        def _run_degraded_local_tests(self, api_obj):
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
   877
                outfile = os.path.join(self.testdata_dir, "res")
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
   878
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
   879
                # This finds something because the client side
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
   880
                # manifest has had the name of the package inserted
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
   881
                # into it.
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
   882
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
   883
                self._search_op_slow(api_obj, False, "example_pkg",
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
   884
                    self.res_local_pkg)
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
   885
                self._search_op_slow(api_obj, False, "example_path",
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
   886
                    self.res_local_path)
1127
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
   887
                self._search_op_slow(api_obj, False, "(example_path)",
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
   888
                    self.res_local_path)
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
   889
                self._search_op_slow(api_obj, False, "<exam*:::>",
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
   890
                    self.res_local_pkg_ret_pkg, return_actions=False)
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
   891
                self._search_op_slow(api_obj, False,
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
   892
                    "::com.sun.service.info_url:",
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
   893
                    self.res_remote_url)
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
   894
                self._search_op_slow(api_obj, False, ":::e* AND *path",
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
   895
                    self.res_local_path)
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
   896
                self._search_op_slow(api_obj, False, "e* AND *path",
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
   897
                    self.res_local_path)
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
   898
                self._search_op_slow(api_obj, False, "<e*>",
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
   899
                    self.res_local_pkg_ret_pkg, return_actions=False)
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
   900
                self._search_op_slow(api_obj, False, "<e*> AND <e*>",
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
   901
                    self.res_local_pkg_ret_pkg, return_actions=False)
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
   902
                self._search_op_slow(api_obj, False, "<e*> OR <e*>",
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
   903
                    self.res_local_pkg_ret_pkg, return_actions=False)
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
   904
                self._search_op_slow(api_obj, False, "<exam:::>",
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
   905
                    self.res_local_pkg_ret_pkg, return_actions=False)
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
   906
                self._search_op_slow(api_obj, False, "exam:::e*path",
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
   907
                    self.res_local_path)
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
   908
                self._search_op_slow(api_obj, False, "exam:::e*path AND e*:::",
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
   909
                    self.res_local_path)
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
   910
                self._search_op_slow(api_obj, False, "e*::: AND exam:::*path",
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
   911
                    self.res_remote_path_extra)
941
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
   912
                self._search_op_slow(api_obj, False, "example*",
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
   913
                    self.res_local_wildcard)
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
   914
                self._search_op_slow(api_obj, False, "/bin", self.res_local_bin)
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
   915
                self._search_op_slow(api_obj, False, "4851433",
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
   916
                    self.res_local_bug_id)
1127
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
   917
                self._search_op_slow(api_obj, False, "<4851433> AND <4725245>",
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
   918
                    self.res_local_pkg_ret_pkg, return_actions=False)
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
   919
                self._search_op_slow(api_obj, False, "4851433 AND 4725245",
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
   920
                    self.res_local_bug_id)
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
   921
                self._search_op_slow(api_obj, False,
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
   922
                    "4851433 AND 4725245 OR example_path",
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
   923
                    self.res_local_bug_id)
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
   924
                self._search_op_slow(api_obj, False,
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
   925
                    "4851433 AND (4725245 OR example_path)",
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
   926
                    self.res_local_bug_id)
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
   927
                self._search_op_slow(api_obj, False,
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
   928
                    "(4851433 AND 4725245) OR example_path",
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
   929
                    self.res_local_bug_id | self.res_local_path)
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
   930
                self._search_op_slow(api_obj, False, "4851433 OR 4725245",
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
   931
                    self.res_local_bug_id | self.res_remote_bug_id_4725245)
941
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
   932
                self._search_op_slow(api_obj, False, "6556919",
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
   933
                    self.res_local_inc_changes)
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
   934
                self._search_op_slow(api_obj, False, "65569??",
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
   935
                    self.res_local_inc_changes)
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
   936
                self._search_op_slow(api_obj, False, "42",
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
   937
                    self.res_local_random_test)
1127
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
   938
                self._search_op_slow(api_obj, False, "79",
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
   939
                    self.res_remote_random_test_79)
941
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
   940
                self._search_op_slow(api_obj, False, "separator",
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
   941
                    self.res_local_keywords)
1127
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
   942
                self._search_op_slow(api_obj, False, "\"sort 0x86\"",
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
   943
                    self.res_remote_keywords_sort_phrase)
941
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
   944
                self._search_op_slow(api_obj, False, "*example*",
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
   945
                    self.res_local_glob)
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
   946
                self._search_op_slow(api_obj, False, "fooo", self.res_local_foo)
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
   947
                self._search_op_slow(api_obj, False, "fo*", self.res_local_foo)
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
   948
                self._search_op_slow(api_obj, False, "bar", self.res_local_bar)
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
   949
                self._search_op_slow(api_obj, False, "openssl",
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
   950
                    self.res_local_openssl)
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
   951
                self._search_op_slow(api_obj, False, "OPENSSL",
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
   952
                    self.res_local_openssl)
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
   953
                self._search_op_slow(api_obj, False, "OpEnSsL",
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
   954
                    self.res_local_openssl)
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
   955
                self._search_op_slow(api_obj, False, "OpEnS*",
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
   956
                    self.res_local_openssl)
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
   957
                # These tests are included because a specific bug
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
   958
                # was found during development. These tests prevent regression
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
   959
                # back to that bug. Exit status of 1 is expected because the
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
   960
                # token isn't in the packages.
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
   961
                self._search_op_slow(api_obj, False, "a_non_existent_token",
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
   962
                    set())
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
   963
1360
fbf184c6d55b 1059 search both original input and paths with image root removed
Brock Pytlik <bpytlik@sun.com>
parents: 1354
diff changeset
   964
        def _run_remove_root_search(self, search_func, remote, api_obj, ip):
fbf184c6d55b 1059 search both original input and paths with image root removed
Brock Pytlik <bpytlik@sun.com>
parents: 1354
diff changeset
   965
                search_func(api_obj, remote, [ip + "example_pkg"], set())
fbf184c6d55b 1059 search both original input and paths with image root removed
Brock Pytlik <bpytlik@sun.com>
parents: 1354
diff changeset
   966
                search_func(api_obj, remote, [ip + "bin/example_path"],
fbf184c6d55b 1059 search both original input and paths with image root removed
Brock Pytlik <bpytlik@sun.com>
parents: 1354
diff changeset
   967
                    self.res_remote_path_of_example_path)
fbf184c6d55b 1059 search both original input and paths with image root removed
Brock Pytlik <bpytlik@sun.com>
parents: 1354
diff changeset
   968
                search_func(api_obj, remote, ["(%sbin/example_path)" % ip],
fbf184c6d55b 1059 search both original input and paths with image root removed
Brock Pytlik <bpytlik@sun.com>
parents: 1354
diff changeset
   969
                    self.res_remote_path_of_example_path)
fbf184c6d55b 1059 search both original input and paths with image root removed
Brock Pytlik <bpytlik@sun.com>
parents: 1354
diff changeset
   970
                search_func(api_obj, remote, ["<%sexam*:::>" % ip],
fbf184c6d55b 1059 search both original input and paths with image root removed
Brock Pytlik <bpytlik@sun.com>
parents: 1354
diff changeset
   971
                    set(), return_actions=False)
fbf184c6d55b 1059 search both original input and paths with image root removed
Brock Pytlik <bpytlik@sun.com>
parents: 1354
diff changeset
   972
                search_func(api_obj, remote,
fbf184c6d55b 1059 search both original input and paths with image root removed
Brock Pytlik <bpytlik@sun.com>
parents: 1354
diff changeset
   973
                    ["::%scom.sun.service.info_url:" % ip], set())
fbf184c6d55b 1059 search both original input and paths with image root removed
Brock Pytlik <bpytlik@sun.com>
parents: 1354
diff changeset
   974
                search_func(api_obj, remote,
fbf184c6d55b 1059 search both original input and paths with image root removed
Brock Pytlik <bpytlik@sun.com>
parents: 1354
diff changeset
   975
                    ["%sbin/e* AND %s*path" % (ip, ip)],
fbf184c6d55b 1059 search both original input and paths with image root removed
Brock Pytlik <bpytlik@sun.com>
parents: 1354
diff changeset
   976
                    self.res_remote_path_of_example_path)
fbf184c6d55b 1059 search both original input and paths with image root removed
Brock Pytlik <bpytlik@sun.com>
parents: 1354
diff changeset
   977
                search_func(api_obj, remote,
fbf184c6d55b 1059 search both original input and paths with image root removed
Brock Pytlik <bpytlik@sun.com>
parents: 1354
diff changeset
   978
                    ["(4851433 AND 4725245) OR :file::%sbin/example_path" % ip],
fbf184c6d55b 1059 search both original input and paths with image root removed
Brock Pytlik <bpytlik@sun.com>
parents: 1354
diff changeset
   979
                    self.res_remote_bug_id |
fbf184c6d55b 1059 search both original input and paths with image root removed
Brock Pytlik <bpytlik@sun.com>
parents: 1354
diff changeset
   980
                    self.res_remote_path_of_example_path)
fbf184c6d55b 1059 search both original input and paths with image root removed
Brock Pytlik <bpytlik@sun.com>
parents: 1354
diff changeset
   981
                search_func(api_obj, remote,
fbf184c6d55b 1059 search both original input and paths with image root removed
Brock Pytlik <bpytlik@sun.com>
parents: 1354
diff changeset
   982
                    [":::%sbin/example_path OR (4851433 AND 4725245)" % ip],
fbf184c6d55b 1059 search both original input and paths with image root removed
Brock Pytlik <bpytlik@sun.com>
parents: 1354
diff changeset
   983
                    self.res_remote_bug_id |
fbf184c6d55b 1059 search both original input and paths with image root removed
Brock Pytlik <bpytlik@sun.com>
parents: 1354
diff changeset
   984
                    self.res_remote_path_of_example_path)
fbf184c6d55b 1059 search both original input and paths with image root removed
Brock Pytlik <bpytlik@sun.com>
parents: 1354
diff changeset
   985
                search_func(api_obj, remote,
fbf184c6d55b 1059 search both original input and paths with image root removed
Brock Pytlik <bpytlik@sun.com>
parents: 1354
diff changeset
   986
                    ["%sbin/example_path OR %sbin/example_path" % (ip, ip)],
fbf184c6d55b 1059 search both original input and paths with image root removed
Brock Pytlik <bpytlik@sun.com>
parents: 1354
diff changeset
   987
                    self.res_remote_path_of_example_path)
fbf184c6d55b 1059 search both original input and paths with image root removed
Brock Pytlik <bpytlik@sun.com>
parents: 1354
diff changeset
   988
                search_func(api_obj, remote,
fbf184c6d55b 1059 search both original input and paths with image root removed
Brock Pytlik <bpytlik@sun.com>
parents: 1354
diff changeset
   989
                    ["<::path:%sbin/example_path> OR <(a AND b)>" % ip],
fbf184c6d55b 1059 search both original input and paths with image root removed
Brock Pytlik <bpytlik@sun.com>
parents: 1354
diff changeset
   990
                    self.res_remote_pkg_ret_pkg, return_actions=False)
fbf184c6d55b 1059 search both original input and paths with image root removed
Brock Pytlik <bpytlik@sun.com>
parents: 1354
diff changeset
   991
                search_func(api_obj, remote,
fbf184c6d55b 1059 search both original input and paths with image root removed
Brock Pytlik <bpytlik@sun.com>
parents: 1354
diff changeset
   992
                    ["<(a AND b)> OR <%sbin/example_path>" % ip],
fbf184c6d55b 1059 search both original input and paths with image root removed
Brock Pytlik <bpytlik@sun.com>
parents: 1354
diff changeset
   993
                    self.res_remote_pkg_ret_pkg, return_actions=False)
fbf184c6d55b 1059 search both original input and paths with image root removed
Brock Pytlik <bpytlik@sun.com>
parents: 1354
diff changeset
   994
                # The tests below here are for testing that multiple queries
fbf184c6d55b 1059 search both original input and paths with image root removed
Brock Pytlik <bpytlik@sun.com>
parents: 1354
diff changeset
   995
                # to search return the results from both queries (bug 10365)
fbf184c6d55b 1059 search both original input and paths with image root removed
Brock Pytlik <bpytlik@sun.com>
parents: 1354
diff changeset
   996
                search_func(api_obj, remote,
fbf184c6d55b 1059 search both original input and paths with image root removed
Brock Pytlik <bpytlik@sun.com>
parents: 1354
diff changeset
   997
                    ["<(a AND b)>",  "example_path"],
fbf184c6d55b 1059 search both original input and paths with image root removed
Brock Pytlik <bpytlik@sun.com>
parents: 1354
diff changeset
   998
                    self.res_remote_path)
fbf184c6d55b 1059 search both original input and paths with image root removed
Brock Pytlik <bpytlik@sun.com>
parents: 1354
diff changeset
   999
                search_func(api_obj, remote,
fbf184c6d55b 1059 search both original input and paths with image root removed
Brock Pytlik <bpytlik@sun.com>
parents: 1354
diff changeset
  1000
                    ["example_path", "<(a AND b)>"],
fbf184c6d55b 1059 search both original input and paths with image root removed
Brock Pytlik <bpytlik@sun.com>
parents: 1354
diff changeset
  1001
                    self.res_remote_path)
fbf184c6d55b 1059 search both original input and paths with image root removed
Brock Pytlik <bpytlik@sun.com>
parents: 1354
diff changeset
  1002
                search_func(api_obj, remote,
fbf184c6d55b 1059 search both original input and paths with image root removed
Brock Pytlik <bpytlik@sun.com>
parents: 1354
diff changeset
  1003
                    [":::%sbin/example_path" % ip, "(4851433 AND 4725245)"],
fbf184c6d55b 1059 search both original input and paths with image root removed
Brock Pytlik <bpytlik@sun.com>
parents: 1354
diff changeset
  1004
                    self.res_remote_bug_id |
fbf184c6d55b 1059 search both original input and paths with image root removed
Brock Pytlik <bpytlik@sun.com>
parents: 1354
diff changeset
  1005
                    self.res_remote_path_of_example_path)
fbf184c6d55b 1059 search both original input and paths with image root removed
Brock Pytlik <bpytlik@sun.com>
parents: 1354
diff changeset
  1006
                search_func(api_obj, remote,
fbf184c6d55b 1059 search both original input and paths with image root removed
Brock Pytlik <bpytlik@sun.com>
parents: 1354
diff changeset
  1007
                    ["(4851433 AND 4725245)", ":::%sbin/example_path" % ip],
fbf184c6d55b 1059 search both original input and paths with image root removed
Brock Pytlik <bpytlik@sun.com>
parents: 1354
diff changeset
  1008
                    self.res_remote_bug_id |
fbf184c6d55b 1059 search both original input and paths with image root removed
Brock Pytlik <bpytlik@sun.com>
parents: 1354
diff changeset
  1009
                    self.res_remote_path_of_example_path)
fbf184c6d55b 1059 search both original input and paths with image root removed
Brock Pytlik <bpytlik@sun.com>
parents: 1354
diff changeset
  1010
941
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
  1011
        def _run_local_tests_example11_installed(self, api_obj):
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
  1012
                outfile = os.path.join(self.testdata_dir, "res")
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
  1013
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
  1014
                # This finds something because the client side
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
  1015
                # manifest has had the name of the package inserted
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
  1016
                # into it.
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
  1017
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
  1018
                self._search_op(api_obj, False, "example_pkg",
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
  1019
                    self.res_local_pkg_example11)
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
  1020
                self._search_op(api_obj, False, "example_path", set())
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
  1021
                self._search_op(api_obj, False, "example_path11",
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
  1022
                    self.res_local_path_example11)
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
  1023
                self._search_op(api_obj, False, "example*",
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
  1024
                    self.res_local_wildcard_example11)
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
  1025
                self._search_op(api_obj, False, "/bin",
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
  1026
                    self.res_local_bin_example11)
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
  1027
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
  1028
        def _run_local_empty_tests(self, api_obj):
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
  1029
                self._search_op(api_obj, False, "example_pkg", set())
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
  1030
                self._search_op(api_obj, False, "example_path", set())
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
  1031
                self._search_op(api_obj, False, "example*", set())
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
  1032
                self._search_op(api_obj, False, "/bin", set())
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
  1033
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
  1034
        def _run_remote_empty_tests(self, api_obj):
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
  1035
                self._search_op(api_obj, True, "example_pkg", set())
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
  1036
                self._search_op(api_obj, True, "example_path", set())
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
  1037
                self._search_op(api_obj, True, "example*", set())
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
  1038
                self._search_op(api_obj, True, "/bin", set())
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
  1039
                self._search_op(api_obj, True, "*unique*", set())
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
  1040
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
  1041
        @staticmethod
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
  1042
        def _restore_dir(index_dir, index_dir_tmp):
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
  1043
                shutil.rmtree(index_dir)
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
  1044
                shutil.move(index_dir_tmp, index_dir)
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
  1045
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
  1046
        @staticmethod
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
  1047
        def _restore_dir_preserve_hash(index_dir, index_dir_tmp):
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
  1048
                tmp_file = "full_fmri_list.hash"
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
  1049
                portable.remove(os.path.join(index_dir_tmp, tmp_file))
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
  1050
                shutil.move(os.path.join(index_dir, tmp_file),
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
  1051
                            index_dir_tmp)
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
  1052
                fh = open(os.path.join(index_dir_tmp, ss.MAIN_FILE), "r")
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
  1053
                fh.seek(0)
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
  1054
                fh.seek(9)
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
  1055
                ver = fh.read(1)
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
  1056
                fh.close()
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
  1057
                fh = open(os.path.join(index_dir_tmp, tmp_file), "r+")
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
  1058
                fh.seek(0)
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
  1059
                fh.seek(9)
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
  1060
                # Overwrite the existing version number.
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
  1061
                # By definition, the version 0 is never used.
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
  1062
                fh.write("%s" % ver)
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
  1063
                shutil.rmtree(index_dir)
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
  1064
                shutil.move(index_dir_tmp, index_dir)
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
  1065
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
  1066
        def _get_index_dirs(self):
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
  1067
                index_dir = os.path.join(self.img_path, "var","pkg","index")
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
  1068
                index_dir_tmp = index_dir + "TMP"
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
  1069
                return index_dir, index_dir_tmp
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
  1070
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
  1071
        @staticmethod
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
  1072
        def _overwrite_version_number(file_path):
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
  1073
                fh = open(file_path, "r+")
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
  1074
                fh.seek(0)
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
  1075
                fh.seek(9)
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
  1076
                # Overwrite the existing version number.
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
  1077
                # By definition, the version 0 is never used.
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
  1078
                fh.write("0")
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
  1079
                fh.close()
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
  1080
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
  1081
        @staticmethod
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
  1082
        def _overwrite_on_disk_format_version_number(file_path):
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
  1083
                fh = open(file_path, "r+")
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
  1084
                fh.seek(0)
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
  1085
                fh.seek(16)
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
  1086
                # Overwrite the existing version number.
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
  1087
                # By definition, the version 0 is never used.
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
  1088
                fh.write("9")
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
  1089
                fh.close()
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
  1090
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
  1091
        @staticmethod
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
  1092
        def _overwrite_on_disk_format_version_number_with_letter(file_path):
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
  1093
                fh = open(file_path, "r+")
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
  1094
                fh.seek(0)
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
  1095
                fh.seek(16)
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
  1096
                # Overwrite the existing version number.
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
  1097
                # By definition, the version 0 is never used.
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
  1098
                fh.write("a")
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
  1099
                fh.close()
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
  1100
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
  1101
        @staticmethod
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
  1102
        def _replace_on_disk_format_version(dir):
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
  1103
                file_path = os.path.join(dir, ss.BYTE_OFFSET_FILE)
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
  1104
                fh = open(file_path, "r")
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
  1105
                lst = fh.readlines()
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
  1106
                fh.close()
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
  1107
                fh = open(file_path, "w")
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
  1108
                fh.write(lst[0])
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
  1109
                for l in lst[2:]:
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
  1110
                        fh.write(l)
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
  1111
                fh.close()
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
  1112
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
  1113
        @staticmethod
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
  1114
        def _overwrite_hash(ffh_path):
1230
4bc74e5d6c3d 10046 client always rereads dictionaries
Brock Pytlik <bpytlik@sun.com>
parents: 1191
diff changeset
  1115
                fd, tmp = tempfile.mkstemp()
4bc74e5d6c3d 10046 client always rereads dictionaries
Brock Pytlik <bpytlik@sun.com>
parents: 1191
diff changeset
  1116
                portable.copyfile(ffh_path, tmp)
4bc74e5d6c3d 10046 client always rereads dictionaries
Brock Pytlik <bpytlik@sun.com>
parents: 1191
diff changeset
  1117
                fh = open(tmp, "r+")
941
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
  1118
                fh.seek(0)
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
  1119
                fh.seek(20)
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
  1120
                fh.write("*")
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
  1121
                fh.close()
1230
4bc74e5d6c3d 10046 client always rereads dictionaries
Brock Pytlik <bpytlik@sun.com>
parents: 1191
diff changeset
  1122
                portable.rename(tmp, ffh_path)
941
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
  1123
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
  1124
        def _check_no_index(self):
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
  1125
                ind_dir, ind_dir_tmp = self._get_index_dirs()
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
  1126
                if os.listdir(ind_dir):
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
  1127
                        self.assert_(0)
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
  1128
                if os.path.exists(ind_dir_tmp):
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
  1129
                        self.assert_(0)
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
  1130
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
  1131
        @staticmethod
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
  1132
        def _do_install(api_obj, pkg_list, **kwargs):
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
  1133
                api_obj.plan_install(pkg_list, [], **kwargs)
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
  1134
                TestApiSearchBasics._do_finish(api_obj)
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
  1135
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
  1136
        @staticmethod
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
  1137
        def _do_uninstall(api_obj, pkg_list, **kwargs):
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
  1138
                api_obj.plan_uninstall(pkg_list, False, **kwargs)
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
  1139
                TestApiSearchBasics._do_finish(api_obj)
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
  1140
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
  1141
        @staticmethod
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
  1142
        def _do_image_update(api_obj, **kwargs):
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
  1143
                api_obj.plan_update_all(sys.argv[0], **kwargs)
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
  1144
                TestApiSearchBasics._do_finish(api_obj)
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
  1145
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
  1146
        @staticmethod
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
  1147
        def _do_finish(api_obj):
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
  1148
                api_obj.prepare()
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
  1149
                api_obj.execute_plan()
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
  1150
                api_obj.reset()
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
  1151
1291
0f82f71cbf19 9845 Query.fromstr needs more error handling
Brock Pytlik <bpytlik@sun.com>
parents: 1286
diff changeset
  1152
        @staticmethod
0f82f71cbf19 9845 Query.fromstr needs more error handling
Brock Pytlik <bpytlik@sun.com>
parents: 1286
diff changeset
  1153
        def validateAssertRaises(ex_type, validate_func, func, *args, **kwargs):
0f82f71cbf19 9845 Query.fromstr needs more error handling
Brock Pytlik <bpytlik@sun.com>
parents: 1286
diff changeset
  1154
                try:
0f82f71cbf19 9845 Query.fromstr needs more error handling
Brock Pytlik <bpytlik@sun.com>
parents: 1286
diff changeset
  1155
                        func(*args, **kwargs)
0f82f71cbf19 9845 Query.fromstr needs more error handling
Brock Pytlik <bpytlik@sun.com>
parents: 1286
diff changeset
  1156
                except ex_type, e:
0f82f71cbf19 9845 Query.fromstr needs more error handling
Brock Pytlik <bpytlik@sun.com>
parents: 1286
diff changeset
  1157
                        validate_func(e)
0f82f71cbf19 9845 Query.fromstr needs more error handling
Brock Pytlik <bpytlik@sun.com>
parents: 1286
diff changeset
  1158
                else:
0f82f71cbf19 9845 Query.fromstr needs more error handling
Brock Pytlik <bpytlik@sun.com>
parents: 1286
diff changeset
  1159
                        raise RuntimeError("Didn't raise expected exception.")
0f82f71cbf19 9845 Query.fromstr needs more error handling
Brock Pytlik <bpytlik@sun.com>
parents: 1286
diff changeset
  1160
0f82f71cbf19 9845 Query.fromstr needs more error handling
Brock Pytlik <bpytlik@sun.com>
parents: 1286
diff changeset
  1161
        @staticmethod
0f82f71cbf19 9845 Query.fromstr needs more error handling
Brock Pytlik <bpytlik@sun.com>
parents: 1286
diff changeset
  1162
        def _check_err(e, expected_str, expected_code):
0f82f71cbf19 9845 Query.fromstr needs more error handling
Brock Pytlik <bpytlik@sun.com>
parents: 1286
diff changeset
  1163
                err = e.read()
0f82f71cbf19 9845 Query.fromstr needs more error handling
Brock Pytlik <bpytlik@sun.com>
parents: 1286
diff changeset
  1164
                if expected_code != e.code:
0f82f71cbf19 9845 Query.fromstr needs more error handling
Brock Pytlik <bpytlik@sun.com>
parents: 1286
diff changeset
  1165
                        raise RuntimeError("Got wrong code, expected %s got "
0f82f71cbf19 9845 Query.fromstr needs more error handling
Brock Pytlik <bpytlik@sun.com>
parents: 1286
diff changeset
  1166
                            "%s" % (expected_code, e.code))
0f82f71cbf19 9845 Query.fromstr needs more error handling
Brock Pytlik <bpytlik@sun.com>
parents: 1286
diff changeset
  1167
                if expected_str not in err:
0f82f71cbf19 9845 Query.fromstr needs more error handling
Brock Pytlik <bpytlik@sun.com>
parents: 1286
diff changeset
  1168
                        raise RuntimeError("Got unexpected error message of:\n"
0f82f71cbf19 9845 Query.fromstr needs more error handling
Brock Pytlik <bpytlik@sun.com>
parents: 1286
diff changeset
  1169
                            "%s" % err)
0f82f71cbf19 9845 Query.fromstr needs more error handling
Brock Pytlik <bpytlik@sun.com>
parents: 1286
diff changeset
  1170
1127
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
  1171
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
  1172
class TestApiSearchBasicsPersistentDepot(TestApiSearchBasics):
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
  1173
        # Only start/stop the depot once (instead of for every test)
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
  1174
        persistent_depot = True
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
  1175
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
  1176
        def __init__(self, *args, **kwargs):
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
  1177
                TestApiSearchBasics.__init__(self, *args, **kwargs)
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
  1178
                self.sent_pkgs = set()
1431
62b6033670e4 10416 server catalog v1 support desired
Shawn Walker <srw@sun.com>
parents: 1423
diff changeset
  1179
1127
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
  1180
        def pkgsend_bulk(self, durl, pkg, optional=True):
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
  1181
                if pkg not in self.sent_pkgs or optional == False:
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
  1182
                        self.sent_pkgs.add(pkg)
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
  1183
                        TestApiSearchBasics.pkgsend_bulk(self, durl, pkg)
1431
62b6033670e4 10416 server catalog v1 support desired
Shawn Walker <srw@sun.com>
parents: 1423
diff changeset
  1184
1127
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
  1185
        def test_010_remote(self):
941
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
  1186
                """Test remote search."""
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
  1187
                durl = self.dc.get_depot_url()
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
  1188
                self.pkgsend_bulk(durl, self.example_pkg10)
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
  1189
                self.image_create(durl)
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
  1190
                progresstracker = progress.NullProgressTracker()
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
  1191
                api_obj = api.ImageInterface(self.get_img_path(), API_VERSION,
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
  1192
                    progresstracker, lambda x: False, PKG_CLIENT_NAME)
1127
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
  1193
                time.sleep(1)
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
  1194
                # This should be a full test to test all functionality.
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
  1195
                self._run_full_remote_tests(api_obj)
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
  1196
                self._search_op(api_obj, True, ":file::", self.res_remote_file)
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
  1197
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
  1198
        def test_020_local_0(self):
941
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
  1199
                """Install one package, and run the search suite."""
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
  1200
                durl = self.dc.get_depot_url()
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
  1201
                self.pkgsend_bulk(durl, self.example_pkg10)
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
  1202
                self.image_create(durl)
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
  1203
                progresstracker = progress.NullProgressTracker()
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
  1204
                api_obj = api.ImageInterface(self.get_img_path(), API_VERSION,
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
  1205
                    progresstracker, lambda x: False, PKG_CLIENT_NAME)
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
  1206
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
  1207
                self._do_install(api_obj, ["example_pkg"])
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
  1208
1127
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
  1209
                self._run_full_local_tests(api_obj)
941
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
  1210
1127
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
  1211
        def test_030_degraded_local(self):
941
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
  1212
                """Install one package, and run the search suite."""
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
  1213
                durl = self.dc.get_depot_url()
1127
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
  1214
                fmris = self.pkgsend_bulk(durl, self.example_pkg10)
941
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
  1215
                self.image_create(durl)
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
  1216
                progresstracker = progress.NullProgressTracker()
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
  1217
                api_obj = api.ImageInterface(self.get_img_path(), API_VERSION,
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
  1218
                    progresstracker, lambda x: False, PKG_CLIENT_NAME)
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
  1219
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
  1220
                self._do_install(api_obj, ["example_pkg"])
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
  1221
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
  1222
                index_dir = os.path.join(self.img_path, "var","pkg","index")
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
  1223
                shutil.rmtree(index_dir)
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
  1224
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
  1225
                self._run_degraded_local_tests(api_obj)
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
  1226
1127
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
  1227
        def test_040_repeated_install_uninstall(self):
941
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
  1228
                """Install and uninstall a package. Checking search both
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
  1229
                after each change to the image."""
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
  1230
                # During development, the index could become corrupted by
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
  1231
                # repeated installing and uninstalling a package. This
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
  1232
                # tests if that has been fixed.
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
  1233
                repeat = 3
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
  1234
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
  1235
                durl = self.dc.get_depot_url()
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
  1236
                self.pkgsend_bulk(durl, self.example_pkg10)
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
  1237
                self.image_create(durl)
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
  1238
                progresstracker = progress.NullProgressTracker()
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
  1239
                api_obj = api.ImageInterface(self.get_img_path(), API_VERSION,
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
  1240
                    progresstracker, lambda x: False, PKG_CLIENT_NAME)
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
  1241
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
  1242
                self._do_install(api_obj, ["example_pkg"])
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
  1243
                self._do_uninstall(api_obj, ["example_pkg"])
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
  1244
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
  1245
                for i in range(1, repeat):
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
  1246
                        self._do_install(api_obj, ["example_pkg"])
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
  1247
                        self._run_local_tests(api_obj)
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
  1248
                        self._do_uninstall(api_obj, ["example_pkg"])
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
  1249
                        api_obj.reset()
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
  1250
                        self._run_local_empty_tests(api_obj)
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
  1251
1127
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
  1252
        def test_050_local_case_sensitive(self):
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
  1253
                """Test local case sensitive search"""
941
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
  1254
                durl = self.dc.get_depot_url()
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
  1255
                self.pkgsend_bulk(durl, self.example_pkg10)
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
  1256
                self.image_create(durl)
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
  1257
                progresstracker = progress.NullProgressTracker()
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
  1258
                api_obj = api.ImageInterface(self.get_img_path(), API_VERSION,
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
  1259
                    progresstracker, lambda x: False, PKG_CLIENT_NAME)
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
  1260
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
  1261
                self._do_install(api_obj, ["example_pkg"])
1127
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
  1262
                self._search_op(api_obj, False, "fooo", set(), True)
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
  1263
                self._search_op(api_obj, False, "fo*", set(), True)
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
  1264
                self._search_op(api_obj, False, "bar", set(), True)
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
  1265
                self._search_op(api_obj, False, "FOOO", self.res_local_foo,
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
  1266
                    True)
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
  1267
                self._search_op(api_obj, False, "bAr", self.res_local_bar, True)
941
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
  1268
1127
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
  1269
        def test_060_missing_files(self):
941
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
  1270
                """Test to check for stack trace when files missing.
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
  1271
                Bug 2753"""
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
  1272
                durl = self.dc.get_depot_url()
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
  1273
                self.pkgsend_bulk(durl, self.example_pkg10)
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
  1274
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
  1275
                self.image_create(durl)
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
  1276
                progresstracker = progress.NullProgressTracker()
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
  1277
                api_obj = api.ImageInterface(self.get_img_path(), API_VERSION,
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
  1278
                    progresstracker, lambda x: False, PKG_CLIENT_NAME)
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
  1279
                self._do_install(api_obj, ["example_pkg"])
1431
62b6033670e4 10416 server catalog v1 support desired
Shawn Walker <srw@sun.com>
parents: 1423
diff changeset
  1280
941
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
  1281
                index_dir = os.path.join(self.img_path, "var","pkg","index")
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
  1282
1127
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
  1283
                first = True
1431
62b6033670e4 10416 server catalog v1 support desired
Shawn Walker <srw@sun.com>
parents: 1423
diff changeset
  1284
941
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
  1285
                for d in query_parser.TermQuery._global_data_dict.values():
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
  1286
                        orig_fn = d.get_file_name()
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
  1287
                        orig_path = os.path.join(index_dir, orig_fn)
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
  1288
                        dest_fn = orig_fn + "TMP"
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
  1289
                        dest_path = os.path.join(index_dir, dest_fn)
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
  1290
                        portable.rename(orig_path, dest_path)
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
  1291
                        self.assertRaises(api_errors.InconsistentIndexException,
1054
9cb4a6f869af 8003 Indexing should be faster
Brock Pytlik <bpytlik@sun.com>
parents: 1009
diff changeset
  1292
                            self._search_op, api_obj, False,
9cb4a6f869af 8003 Indexing should be faster
Brock Pytlik <bpytlik@sun.com>
parents: 1009
diff changeset
  1293
                            "exam:::example_pkg", [])
1127
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
  1294
                        if first:
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
  1295
                                # Run the shell version once to check that no
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
  1296
                                # stack trace happens.
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
  1297
                                self.pkg("search -l 'exam:::example_pkg'",
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
  1298
                                    exit=1)
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
  1299
                                first = False
941
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
  1300
                        portable.rename(dest_path, orig_path)
1127
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
  1301
                        self._search_op(api_obj, False, "exam:::example_pkg",
941
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
  1302
                            self.res_local_pkg)
1127
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
  1303
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
  1304
        def test_070_mismatched_versions(self):
941
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
  1305
                """Test to check for stack trace when files missing.
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
  1306
                Bug 2753"""
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
  1307
                durl = self.dc.get_depot_url()
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
  1308
                self.pkgsend_bulk(durl, self.example_pkg10)
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
  1309
                self.image_create(durl)
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
  1310
                progresstracker = progress.NullProgressTracker()
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
  1311
                api_obj = api.ImageInterface(self.get_img_path(), API_VERSION,
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
  1312
                    progresstracker, lambda x: False, PKG_CLIENT_NAME)
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
  1313
                self._do_install(api_obj, ["example_pkg"])
1431
62b6033670e4 10416 server catalog v1 support desired
Shawn Walker <srw@sun.com>
parents: 1423
diff changeset
  1314
941
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
  1315
                index_dir = os.path.join(self.img_path, "var","pkg","index")
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
  1316
1127
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
  1317
                first = True
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
  1318
941
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
  1319
                for d in query_parser.TermQuery._global_data_dict.values():
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
  1320
                        orig_fn = d.get_file_name()
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
  1321
                        orig_path = os.path.join(index_dir, orig_fn)
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
  1322
                        dest_fn = orig_fn + "TMP"
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
  1323
                        dest_path = os.path.join(index_dir, dest_fn)
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
  1324
                        shutil.copy(orig_path, dest_path)
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
  1325
                        self._overwrite_version_number(orig_path)
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
  1326
                        api_obj.reset()
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
  1327
                        self.assertRaises(api_errors.InconsistentIndexException,
1054
9cb4a6f869af 8003 Indexing should be faster
Brock Pytlik <bpytlik@sun.com>
parents: 1009
diff changeset
  1328
                            self._search_op, api_obj, False,
9cb4a6f869af 8003 Indexing should be faster
Brock Pytlik <bpytlik@sun.com>
parents: 1009
diff changeset
  1329
                            "exam:::example_pkg", [])
1127
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
  1330
                        if first:
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
  1331
                                # Run the shell version once to check that no
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
  1332
                                # stack trace happens.
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
  1333
                                self.pkg("search -l 'exam:::example_pkg'",
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
  1334
                                    exit=1)
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
  1335
                                first = False
941
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
  1336
                        portable.rename(dest_path, orig_path)
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
  1337
                        self._search_op(api_obj, False, "example_pkg",
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
  1338
                            self.res_local_pkg)
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
  1339
                        self._overwrite_version_number(orig_path)
1286
2e5bb564a9e2 8948 search errors should make it clear that the rest of the command worked
Brock Pytlik <bpytlik@sun.com>
parents: 1271
diff changeset
  1340
                        self.assertRaises(
2e5bb564a9e2 8948 search errors should make it clear that the rest of the command worked
Brock Pytlik <bpytlik@sun.com>
parents: 1271
diff changeset
  1341
                            api_errors.WrapSuccessfulIndexingException,
2e5bb564a9e2 8948 search errors should make it clear that the rest of the command worked
Brock Pytlik <bpytlik@sun.com>
parents: 1271
diff changeset
  1342
                            self._do_uninstall, api_obj, ["example_pkg"])
2e5bb564a9e2 8948 search errors should make it clear that the rest of the command worked
Brock Pytlik <bpytlik@sun.com>
parents: 1271
diff changeset
  1343
                        api_obj.reset()
941
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
  1344
                        self._search_op(api_obj, False, "example_pkg", set())
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
  1345
                        self._overwrite_version_number(orig_path)
1286
2e5bb564a9e2 8948 search errors should make it clear that the rest of the command worked
Brock Pytlik <bpytlik@sun.com>
parents: 1271
diff changeset
  1346
                        self.assertRaises(
2e5bb564a9e2 8948 search errors should make it clear that the rest of the command worked
Brock Pytlik <bpytlik@sun.com>
parents: 1271
diff changeset
  1347
                            api_errors.WrapSuccessfulIndexingException,
2e5bb564a9e2 8948 search errors should make it clear that the rest of the command worked
Brock Pytlik <bpytlik@sun.com>
parents: 1271
diff changeset
  1348
                            self._do_install, api_obj, ["example_pkg"])
941
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
  1349
                        api_obj.reset()
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
  1350
                        self._search_op(api_obj, False, "example_pkg",
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
  1351
                            self.res_local_pkg)
1230
4bc74e5d6c3d 10046 client always rereads dictionaries
Brock Pytlik <bpytlik@sun.com>
parents: 1191
diff changeset
  1352
941
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
  1353
                ffh = ss.IndexStoreSetHash(ss.FULL_FMRI_HASH_FILE)
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
  1354
                ffh_path = os.path.join(index_dir, ffh.get_file_name())
1230
4bc74e5d6c3d 10046 client always rereads dictionaries
Brock Pytlik <bpytlik@sun.com>
parents: 1191
diff changeset
  1355
                dest_fh, dest_path = tempfile.mkstemp()
941
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
  1356
                shutil.copy(ffh_path, dest_path)
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
  1357
                self._overwrite_hash(ffh_path)
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
  1358
                self.assertRaises(api_errors.IncorrectIndexFileHash,
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
  1359
                    self._search_op, api_obj, False, "example_pkg", set())
1127
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
  1360
                # Run the shell version of the test to check for a stack trace.
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
  1361
                self.pkg("search -l 'exam:::example_pkg'", exit=1)
941
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
  1362
                portable.rename(dest_path, ffh_path)
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
  1363
                self._search_op(api_obj, False, "example_pkg",
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
  1364
                    self.res_local_pkg)
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
  1365
                self._overwrite_hash(ffh_path)
1286
2e5bb564a9e2 8948 search errors should make it clear that the rest of the command worked
Brock Pytlik <bpytlik@sun.com>
parents: 1271
diff changeset
  1366
                self.assertRaises(api_errors.WrapSuccessfulIndexingException,
2e5bb564a9e2 8948 search errors should make it clear that the rest of the command worked
Brock Pytlik <bpytlik@sun.com>
parents: 1271
diff changeset
  1367
                    self._do_uninstall, api_obj, ["example_pkg"])
941
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
  1368
                self._search_op(api_obj, False, "example_pkg", set())
1127
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
  1369
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
  1370
        def test_080_weird_patterns(self):
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
  1371
                """Test strange patterns to ensure they're handled correctly"""
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
  1372
                durl = self.dc.get_depot_url()
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
  1373
                self.pkgsend_bulk(durl, self.example_pkg10)
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
  1374
                self.image_create(durl)
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
  1375
                progresstracker = progress.NullProgressTracker()
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
  1376
                api_obj = api.ImageInterface(self.get_img_path(), API_VERSION,
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
  1377
                    progresstracker, lambda x: False, PKG_CLIENT_NAME)
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
  1378
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
  1379
                self._search_op(api_obj, True, "[*]", self.res_remote_star)
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
  1380
                self._search_op(api_obj, True, "[?]", self.res_remote_mark)
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
  1381
                self._search_op(api_obj, True, "[[]",
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
  1382
                    self.res_remote_left_brace)
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
  1383
                self._search_op(api_obj, True, "[]]",
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
  1384
                    self.res_remote_right_brace)
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
  1385
                self._search_op(api_obj, True, "FO[O]O", self.res_remote_foo)
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
  1386
                self._search_op(api_obj, True, "FO[?O]O", self.res_remote_foo)
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
  1387
                self._search_op(api_obj, True, "FO[*O]O", self.res_remote_foo)
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
  1388
                self._search_op(api_obj, True, "FO[]O]O", self.res_remote_foo)
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
  1389
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
  1390
        def test_090_bug_7660(self):
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
  1391
                """Test that installing a package doesn't prevent searching on
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
  1392
                package names from working on previously installed packages."""
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
  1393
                durl = self.dc.get_depot_url()
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
  1394
                self.pkgsend_bulk(durl, self.example_pkg10)
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
  1395
                self.pkgsend_bulk(durl, self.fat_pkg10)
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
  1396
                self.image_create(durl)
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
  1397
                progresstracker = progress.NullProgressTracker()
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
  1398
                api_obj = api.ImageInterface(self.get_img_path(), API_VERSION,
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
  1399
                    progresstracker, lambda x: True, PKG_CLIENT_NAME)
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
  1400
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
  1401
                tmp_dir = os.path.join(self.img_path, "var", "pkg", "index",
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
  1402
                    "TMP")
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
  1403
                self._do_install(api_obj, ["example_pkg"])
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
  1404
                api_obj.rebuild_search_index()
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
  1405
                self._do_install(api_obj, ["fat"])
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
  1406
                self.assert_(not os.path.exists(tmp_dir))
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
  1407
                self._run_local_tests(api_obj)
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
  1408
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
  1409
        def test_100_bug_6712_i386(self):
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
  1410
                """Install one package, and run the search suite."""
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
  1411
                durl = self.dc.get_depot_url()
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
  1412
                self.pkgsend_bulk(durl, self.fat_pkg10)
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
  1413
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
  1414
                self.image_create(durl,
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
  1415
                    additional_args="--variant variant.arch=i386")
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
  1416
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
  1417
                progresstracker = progress.NullProgressTracker()
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
  1418
                api_obj = api.ImageInterface(self.get_img_path(), API_VERSION,
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
  1419
                    progresstracker, lambda x: True, PKG_CLIENT_NAME)
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
  1420
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
  1421
                remote = True
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
  1422
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
  1423
                self._search_op(api_obj, remote, "fat:::*",
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
  1424
                    self.res_remote_fat10_star)
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
  1425
                self._do_install(api_obj, ["fat"])
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
  1426
                remote = False
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
  1427
                self._search_op(api_obj, remote, "fat:::*",
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
  1428
                    self.res_local_fat10_i386_star)
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
  1429
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
  1430
        def test_110_bug_6712_sparc(self):
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
  1431
                """Install one package, and run the search suite."""
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
  1432
                durl = self.dc.get_depot_url()
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
  1433
                self.pkgsend_bulk(durl, self.fat_pkg10)
1431
62b6033670e4 10416 server catalog v1 support desired
Shawn Walker <srw@sun.com>
parents: 1423
diff changeset
  1434
1127
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
  1435
                self.image_create(durl,
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
  1436
                    additional_args="--variant variant.arch=sparc")
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
  1437
                progresstracker = progress.NullProgressTracker()
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
  1438
                api_obj = api.ImageInterface(self.get_img_path(), API_VERSION,
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
  1439
                    progresstracker, lambda x: True, PKG_CLIENT_NAME)
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
  1440
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
  1441
                remote = True
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
  1442
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
  1443
                self._search_op(api_obj, remote, "fat:::*",
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
  1444
                    self.res_remote_fat10_star)
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
  1445
                self._do_install(api_obj, ["fat"])
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
  1446
                remote = False
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
  1447
                self._search_op(api_obj, remote, "fat:::*",
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
  1448
                    self.res_local_fat10_sparc_star)
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
  1449
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
  1450
        def test_120_bug_3046(self):
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
  1451
                """Checks if directories ending in / break the indexer."""
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
  1452
                durl = self.dc.get_depot_url()
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
  1453
                self.pkgsend_bulk(durl, self.bad_pkg10)
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
  1454
                self.image_create(durl)
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
  1455
                progresstracker = progress.NullProgressTracker()
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
  1456
                api_obj = api.ImageInterface(self.get_img_path(), API_VERSION,
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
  1457
                    progresstracker, lambda x: True, PKG_CLIENT_NAME)
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
  1458
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
  1459
                self._search_op(api_obj, True, "foo", set())
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
  1460
                self._search_op(api_obj, True, "/", set())
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
  1461
1360
fbf184c6d55b 1059 search both original input and paths with image root removed
Brock Pytlik <bpytlik@sun.com>
parents: 1354
diff changeset
  1462
        def test_130_bug_1059(self):
fbf184c6d55b 1059 search both original input and paths with image root removed
Brock Pytlik <bpytlik@sun.com>
parents: 1354
diff changeset
  1463
                """Checks whether the fallback of removing the image root works.
fbf184c6d55b 1059 search both original input and paths with image root removed
Brock Pytlik <bpytlik@sun.com>
parents: 1354
diff changeset
  1464
                Also tests whether multiple queries submitted via the api work.
fbf184c6d55b 1059 search both original input and paths with image root removed
Brock Pytlik <bpytlik@sun.com>
parents: 1354
diff changeset
  1465
                """
fbf184c6d55b 1059 search both original input and paths with image root removed
Brock Pytlik <bpytlik@sun.com>
parents: 1354
diff changeset
  1466
                durl = self.dc.get_depot_url()
fbf184c6d55b 1059 search both original input and paths with image root removed
Brock Pytlik <bpytlik@sun.com>
parents: 1354
diff changeset
  1467
                self.pkgsend_bulk(durl, self.example_pkg10)
fbf184c6d55b 1059 search both original input and paths with image root removed
Brock Pytlik <bpytlik@sun.com>
parents: 1354
diff changeset
  1468
                self.image_create(durl)
fbf184c6d55b 1059 search both original input and paths with image root removed
Brock Pytlik <bpytlik@sun.com>
parents: 1354
diff changeset
  1469
                progresstracker = progress.NullProgressTracker()
fbf184c6d55b 1059 search both original input and paths with image root removed
Brock Pytlik <bpytlik@sun.com>
parents: 1354
diff changeset
  1470
                api_obj = api.ImageInterface(self.get_img_path(), API_VERSION,
fbf184c6d55b 1059 search both original input and paths with image root removed
Brock Pytlik <bpytlik@sun.com>
parents: 1354
diff changeset
  1471
                    progresstracker, lambda x: False, PKG_CLIENT_NAME)
fbf184c6d55b 1059 search both original input and paths with image root removed
Brock Pytlik <bpytlik@sun.com>
parents: 1354
diff changeset
  1472
fbf184c6d55b 1059 search both original input and paths with image root removed
Brock Pytlik <bpytlik@sun.com>
parents: 1354
diff changeset
  1473
                ip = self.get_img_path()
fbf184c6d55b 1059 search both original input and paths with image root removed
Brock Pytlik <bpytlik@sun.com>
parents: 1354
diff changeset
  1474
                if not ip.endswith("/"):
fbf184c6d55b 1059 search both original input and paths with image root removed
Brock Pytlik <bpytlik@sun.com>
parents: 1354
diff changeset
  1475
                        ip += "/"
fbf184c6d55b 1059 search both original input and paths with image root removed
Brock Pytlik <bpytlik@sun.com>
parents: 1354
diff changeset
  1476
fbf184c6d55b 1059 search both original input and paths with image root removed
Brock Pytlik <bpytlik@sun.com>
parents: 1354
diff changeset
  1477
                # Do remote searches
fbf184c6d55b 1059 search both original input and paths with image root removed
Brock Pytlik <bpytlik@sun.com>
parents: 1354
diff changeset
  1478
                self._run_remove_root_search(self._search_op_multi, True,
fbf184c6d55b 1059 search both original input and paths with image root removed
Brock Pytlik <bpytlik@sun.com>
parents: 1354
diff changeset
  1479
                    api_obj, ip)
fbf184c6d55b 1059 search both original input and paths with image root removed
Brock Pytlik <bpytlik@sun.com>
parents: 1354
diff changeset
  1480
fbf184c6d55b 1059 search both original input and paths with image root removed
Brock Pytlik <bpytlik@sun.com>
parents: 1354
diff changeset
  1481
                self._do_install(api_obj, ["example_pkg"])
fbf184c6d55b 1059 search both original input and paths with image root removed
Brock Pytlik <bpytlik@sun.com>
parents: 1354
diff changeset
  1482
                # Do local searches
fbf184c6d55b 1059 search both original input and paths with image root removed
Brock Pytlik <bpytlik@sun.com>
parents: 1354
diff changeset
  1483
                self._run_remove_root_search(self._search_op_multi, False,
fbf184c6d55b 1059 search both original input and paths with image root removed
Brock Pytlik <bpytlik@sun.com>
parents: 1354
diff changeset
  1484
                    api_obj, ip)
fbf184c6d55b 1059 search both original input and paths with image root removed
Brock Pytlik <bpytlik@sun.com>
parents: 1354
diff changeset
  1485
fbf184c6d55b 1059 search both original input and paths with image root removed
Brock Pytlik <bpytlik@sun.com>
parents: 1354
diff changeset
  1486
                index_dir = os.path.join(self.img_path, "var","pkg","index")
fbf184c6d55b 1059 search both original input and paths with image root removed
Brock Pytlik <bpytlik@sun.com>
parents: 1354
diff changeset
  1487
                shutil.rmtree(index_dir)
fbf184c6d55b 1059 search both original input and paths with image root removed
Brock Pytlik <bpytlik@sun.com>
parents: 1354
diff changeset
  1488
                # Do slow local searches
fbf184c6d55b 1059 search both original input and paths with image root removed
Brock Pytlik <bpytlik@sun.com>
parents: 1354
diff changeset
  1489
                self._run_remove_root_search(self._search_op_slow_multi, False,
fbf184c6d55b 1059 search both original input and paths with image root removed
Brock Pytlik <bpytlik@sun.com>
parents: 1354
diff changeset
  1490
                    api_obj, ip)
fbf184c6d55b 1059 search both original input and paths with image root removed
Brock Pytlik <bpytlik@sun.com>
parents: 1354
diff changeset
  1491
1127
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
  1492
        def test_bug_2849(self):
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
  1493
                """Checks if things with spaces break the indexer."""
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
  1494
                durl = self.dc.get_depot_url()
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
  1495
                self.pkgsend_bulk(durl, self.space_pkg10)
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
  1496
                self.image_create(durl)
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
  1497
                progresstracker = progress.NullProgressTracker()
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
  1498
                api_obj = api.ImageInterface(self.get_img_path(), API_VERSION,
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
  1499
                    progresstracker, lambda x: False, PKG_CLIENT_NAME)
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
  1500
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
  1501
                self._do_install(api_obj, ["space_pkg"])
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
  1502
                time.sleep(1)
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
  1503
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
  1504
                self.pkgsend_bulk(durl, self.space_pkg10, optional=False)
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
  1505
                api_obj.refresh(immediate=True)
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
  1506
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
  1507
                self._do_install(api_obj, ["space_pkg"])
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
  1508
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
  1509
                remote = False
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
  1510
                self._search_op(api_obj, remote, 'with', set())
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
  1511
                self._search_op(api_obj, remote, 'with*',
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
  1512
                    self.res_space_with_star)
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
  1513
                self._search_op(api_obj, remote, '*space',
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
  1514
                    self.res_space_space_star)
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
  1515
                self._search_op(api_obj, remote, 'space', set())
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
  1516
                self._search_op(api_obj, remote, 'unique_dir',
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
  1517
                    self.res_space_unique)
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
  1518
                remote = True
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
  1519
                self._search_op(api_obj, remote, 'with', set())
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
  1520
                self._search_op(api_obj, remote, 'with*',
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
  1521
                    self.res_space_with_star)
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
  1522
                self._search_op(api_obj, remote, '*space',
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
  1523
                    self.res_space_space_star)
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
  1524
                self._search_op(api_obj, remote, 'space', set())
1191
a48bee2a4b2e 305 http_proxy value needs more checking for valid url syntax
johansen <johansen@sun.com>
parents: 1146
diff changeset
  1525
                time.sleep(1)
1127
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
  1526
                self.pkgsend_bulk(durl, self.space_pkg10, optional=False)
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
  1527
                # Need to add install of subsequent package and
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
  1528
                # local side search as well as remote
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
  1529
                self._search_op(api_obj, remote, 'with', set())
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
  1530
                self._search_op(api_obj, remote, 'with*',
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
  1531
                    self.res_space_with_star)
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
  1532
                self._search_op(api_obj, remote, '*space',
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
  1533
                    self.res_space_space_star)
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
  1534
                self._search_op(api_obj, remote, 'space', set())
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
  1535
                self._search_op(api_obj, remote, 'unique_dir',
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
  1536
                    self.res_space_unique)
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
  1537
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
  1538
        def test_bug_2863(self):
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
  1539
                """Check that disabling indexing works as expected"""
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
  1540
                durl = self.dc.get_depot_url()
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
  1541
                self.pkgsend_bulk(durl, self.example_pkg10)
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
  1542
                self.image_create(durl)
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
  1543
                progresstracker = progress.NullProgressTracker()
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
  1544
                api_obj = api.ImageInterface(self.get_img_path(), API_VERSION,
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
  1545
                    progresstracker, lambda x: False, PKG_CLIENT_NAME)
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
  1546
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
  1547
                self._check_no_index()
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
  1548
                self._do_install(api_obj, ["example_pkg"], update_index=False)
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
  1549
                self._check_no_index()
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
  1550
                api_obj.rebuild_search_index()
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
  1551
                self._run_local_tests(api_obj)
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
  1552
                self._do_uninstall(api_obj, ["example_pkg"], update_index=False)
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
  1553
                # Running empty test because search will notice the index
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
  1554
                # does not match the installed packages and complain.
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
  1555
                self.assertRaises(api_errors.IncorrectIndexFileHash,
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
  1556
                    self._search_op, api_obj, False, "example_pkg", set())
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
  1557
                api_obj.rebuild_search_index()
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
  1558
                self._run_local_empty_tests(api_obj)
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
  1559
                self._do_install(api_obj, ["example_pkg"])
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
  1560
                self._run_local_tests(api_obj)
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
  1561
                self.pkgsend_bulk(durl, self.example_pkg11)
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
  1562
                api_obj.refresh(immediate=True)
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
  1563
                self._do_image_update(api_obj, update_index=False)
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
  1564
                # Running empty test because search will notice the index
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
  1565
                # does not match the installed packages and complain.
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
  1566
                self.assertRaises(api_errors.IncorrectIndexFileHash,
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
  1567
                    self._search_op, api_obj, False, "example_pkg", set())
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
  1568
                api_obj.rebuild_search_index()
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
  1569
                self._run_local_tests_example11_installed(api_obj)
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
  1570
                self._do_uninstall(api_obj, ["example_pkg"], update_index=False)
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
  1571
                # Running empty test because search will notice the index
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
  1572
                # does not match the installed packages and complain.
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
  1573
                self.assertRaises(api_errors.IncorrectIndexFileHash,
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
  1574
                    self._search_op, api_obj, False, "example_pkg", set())
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
  1575
                api_obj.rebuild_search_index()
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
  1576
                self._run_local_empty_tests(api_obj)
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
  1577
941
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
  1578
        def test_bug_2989_1(self):
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
  1579
                durl = self.dc.get_depot_url()
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
  1580
                self.pkgsend_bulk(durl, self.example_pkg10)
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
  1581
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
  1582
                for f in self._dir_restore_functions:
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
  1583
                        self.image_create(durl)
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
  1584
                        progresstracker = progress.NullProgressTracker()
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
  1585
                        api_obj = api.ImageInterface(self.get_img_path(),
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
  1586
                            API_VERSION, progresstracker, lambda x: False,
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
  1587
                            PKG_CLIENT_NAME)
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
  1588
                        api_obj.rebuild_search_index()
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
  1589
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
  1590
                        index_dir, index_dir_tmp = self._get_index_dirs()
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
  1591
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
  1592
                        shutil.copytree(index_dir, index_dir_tmp)
1431
62b6033670e4 10416 server catalog v1 support desired
Shawn Walker <srw@sun.com>
parents: 1423
diff changeset
  1593
941
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
  1594
                        self._do_install(api_obj, ["example_pkg"])
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
  1595
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
  1596
                        f(index_dir, index_dir_tmp)
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
  1597
1286
2e5bb564a9e2 8948 search errors should make it clear that the rest of the command worked
Brock Pytlik <bpytlik@sun.com>
parents: 1271
diff changeset
  1598
                        self.assertRaises(
2e5bb564a9e2 8948 search errors should make it clear that the rest of the command worked
Brock Pytlik <bpytlik@sun.com>
parents: 1271
diff changeset
  1599
                            api_errors.WrapSuccessfulIndexingException,
2e5bb564a9e2 8948 search errors should make it clear that the rest of the command worked
Brock Pytlik <bpytlik@sun.com>
parents: 1271
diff changeset
  1600
                            self._do_uninstall, api_obj, ["example_pkg"])
941
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
  1601
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
  1602
                        self.image_destroy()
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
  1603
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
  1604
        def test_bug_2989_2(self):
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
  1605
                durl = self.dc.get_depot_url()
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
  1606
                self.pkgsend_bulk(durl, self.example_pkg10)
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
  1607
                self.pkgsend_bulk(durl, self.another_pkg10)
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
  1608
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
  1609
                for f in self._dir_restore_functions:
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
  1610
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
  1611
                        self.image_create(durl)
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
  1612
                        progresstracker = progress.NullProgressTracker()
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
  1613
                        api_obj = api.ImageInterface(self.get_img_path(),
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
  1614
                            API_VERSION, progresstracker, lambda x: False,
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
  1615
                            PKG_CLIENT_NAME)
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
  1616
                        self._do_install(api_obj, ["example_pkg"])
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
  1617
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
  1618
                        index_dir, index_dir_tmp = self._get_index_dirs()
1431
62b6033670e4 10416 server catalog v1 support desired
Shawn Walker <srw@sun.com>
parents: 1423
diff changeset
  1619
941
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
  1620
                        shutil.copytree(index_dir, index_dir_tmp)
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
  1621
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
  1622
                        self._do_install(api_obj, ["another_pkg"])
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
  1623
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
  1624
                        f(index_dir, index_dir_tmp)
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
  1625
1286
2e5bb564a9e2 8948 search errors should make it clear that the rest of the command worked
Brock Pytlik <bpytlik@sun.com>
parents: 1271
diff changeset
  1626
                        self.assertRaises(
2e5bb564a9e2 8948 search errors should make it clear that the rest of the command worked
Brock Pytlik <bpytlik@sun.com>
parents: 1271
diff changeset
  1627
                            api_errors.WrapSuccessfulIndexingException,
2e5bb564a9e2 8948 search errors should make it clear that the rest of the command worked
Brock Pytlik <bpytlik@sun.com>
parents: 1271
diff changeset
  1628
                            self._do_uninstall, api_obj, ["another_pkg"])
941
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
  1629
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
  1630
                        self.image_destroy()
1431
62b6033670e4 10416 server catalog v1 support desired
Shawn Walker <srw@sun.com>
parents: 1423
diff changeset
  1631
941
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
  1632
        def test_bug_2989_3(self):
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
  1633
                durl = self.dc.get_depot_url()
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
  1634
                self.pkgsend_bulk(durl, self.example_pkg10)
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
  1635
                self.pkgsend_bulk(durl, self.example_pkg11)
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
  1636
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
  1637
                for f in self._dir_restore_functions:
1431
62b6033670e4 10416 server catalog v1 support desired
Shawn Walker <srw@sun.com>
parents: 1423
diff changeset
  1638
941
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
  1639
                        self.image_create(durl)
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
  1640
                        progresstracker = progress.NullProgressTracker()
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
  1641
                        api_obj = api.ImageInterface(self.get_img_path(),
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
  1642
                            API_VERSION, progresstracker, lambda x: False,
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
  1643
                            PKG_CLIENT_NAME)
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
  1644
                        self._do_install(api_obj, ["[email protected],5.11-0"])
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
  1645
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
  1646
                        index_dir, index_dir_tmp = self._get_index_dirs()
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
  1647
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
  1648
                        shutil.copytree(index_dir, index_dir_tmp)
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
  1649
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
  1650
                        self._do_install(api_obj, ["example_pkg"])
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
  1651
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
  1652
                        f(index_dir, index_dir_tmp)
1127
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
  1653
1286
2e5bb564a9e2 8948 search errors should make it clear that the rest of the command worked
Brock Pytlik <bpytlik@sun.com>
parents: 1271
diff changeset
  1654
                        self.assertRaises(
2e5bb564a9e2 8948 search errors should make it clear that the rest of the command worked
Brock Pytlik <bpytlik@sun.com>
parents: 1271
diff changeset
  1655
                            api_errors.WrapSuccessfulIndexingException,
2e5bb564a9e2 8948 search errors should make it clear that the rest of the command worked
Brock Pytlik <bpytlik@sun.com>
parents: 1271
diff changeset
  1656
                            self._do_uninstall, api_obj, ["example_pkg"])
941
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
  1657
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
  1658
                        self.image_destroy()
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
  1659
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
  1660
        def test_bug_2989_4(self):
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
  1661
                durl = self.dc.get_depot_url()
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
  1662
                self.pkgsend_bulk(durl, self.another_pkg10)
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
  1663
                self.pkgsend_bulk(durl, self.example_pkg10)
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
  1664
                self.pkgsend_bulk(durl, self.example_pkg11)
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
  1665
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
  1666
                for f in self._dir_restore_functions:
1431
62b6033670e4 10416 server catalog v1 support desired
Shawn Walker <srw@sun.com>
parents: 1423
diff changeset
  1667
941
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
  1668
                        self.image_create(durl)
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
  1669
                        progresstracker = progress.NullProgressTracker()
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
  1670
                        api_obj = api.ImageInterface(self.get_img_path(),
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
  1671
                            API_VERSION, progresstracker, lambda x: False,
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
  1672
                            PKG_CLIENT_NAME)
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
  1673
                        self._do_install(api_obj, ["another_pkg"])
1431
62b6033670e4 10416 server catalog v1 support desired
Shawn Walker <srw@sun.com>
parents: 1423
diff changeset
  1674
941
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
  1675
                        index_dir, index_dir_tmp = self._get_index_dirs()
1431
62b6033670e4 10416 server catalog v1 support desired
Shawn Walker <srw@sun.com>
parents: 1423
diff changeset
  1676
941
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
  1677
                        shutil.copytree(index_dir, index_dir_tmp)
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
  1678
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
  1679
                        self._do_install(api_obj, ["[email protected],5.11-0"])
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
  1680
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
  1681
                        f(index_dir, index_dir_tmp)
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
  1682
1286
2e5bb564a9e2 8948 search errors should make it clear that the rest of the command worked
Brock Pytlik <bpytlik@sun.com>
parents: 1271
diff changeset
  1683
                        self.assertRaises(
2e5bb564a9e2 8948 search errors should make it clear that the rest of the command worked
Brock Pytlik <bpytlik@sun.com>
parents: 1271
diff changeset
  1684
                            api_errors.WrapSuccessfulIndexingException,
2e5bb564a9e2 8948 search errors should make it clear that the rest of the command worked
Brock Pytlik <bpytlik@sun.com>
parents: 1271
diff changeset
  1685
                            self._do_image_update, api_obj)
941
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
  1686
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
  1687
                        self.image_destroy()
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
  1688
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
  1689
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
  1690
        def test_bug_4239(self):
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
  1691
                """Tests whether categories are indexed and searched for
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
  1692
                correctly."""
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
  1693
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
  1694
                def _run_cat_tests(self, remote):
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
  1695
                        self._search_op(api_obj, remote, "System",
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
  1696
                            self.res_cat_pkg10, case_sensitive=False)
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
  1697
                        self._search_op(api_obj, remote, "Security",
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
  1698
                            self.res_cat_pkg10, case_sensitive=False)
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
  1699
                        self._search_op(api_obj, remote, "System/Security",
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
  1700
                            self.res_cat_pkg10, case_sensitive=False)
1115
fae096bd02df 8865 attribute.generate_indicies doesn't handle multivalued info.category actions
Brock Pytlik <bpytlik@sun.com>
parents: 1102
diff changeset
  1701
                        self._search_op(api_obj, remote, "Other/Category",
fae096bd02df 8865 attribute.generate_indicies doesn't handle multivalued info.category actions
Brock Pytlik <bpytlik@sun.com>
parents: 1102
diff changeset
  1702
                            self.res_cat_pkg10_2, case_sensitive=False)
fae096bd02df 8865 attribute.generate_indicies doesn't handle multivalued info.category actions
Brock Pytlik <bpytlik@sun.com>
parents: 1102
diff changeset
  1703
                        self._search_op(api_obj, remote, "Other",
fae096bd02df 8865 attribute.generate_indicies doesn't handle multivalued info.category actions
Brock Pytlik <bpytlik@sun.com>
parents: 1102
diff changeset
  1704
                            self.res_cat_pkg10_2, case_sensitive=False)
fae096bd02df 8865 attribute.generate_indicies doesn't handle multivalued info.category actions
Brock Pytlik <bpytlik@sun.com>
parents: 1102
diff changeset
  1705
                        self._search_op(api_obj, remote, "Category",
fae096bd02df 8865 attribute.generate_indicies doesn't handle multivalued info.category actions
Brock Pytlik <bpytlik@sun.com>
parents: 1102
diff changeset
  1706
                            self.res_cat_pkg10_2, case_sensitive=False)
941
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
  1707
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
  1708
                def _run_cat2_tests(self, remote):
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
  1709
                        self._search_op(api_obj, remote, "Applications",
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
  1710
                            self.res_cat2_pkg10, case_sensitive=False)
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
  1711
                        self._search_op(api_obj, True, "Sound",
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
  1712
                            self.res_cat2_pkg10, case_sensitive=False)
1127
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
  1713
                        self._search_op(api_obj, remote, "Sound and Video",
941
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
  1714
                            self.res_cat2_pkg10, case_sensitive=False)
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
  1715
                        self._search_op(api_obj, remote, "Sound*",
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
  1716
                            self.res_cat2_pkg10, case_sensitive=False)
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
  1717
                        self._search_op(api_obj, remote, "*Video",
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
  1718
                            self.res_cat2_pkg10, case_sensitive=False)
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
  1719
                        self._search_op(api_obj, remote,
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
  1720
                            "'Applications/Sound and Video'",
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
  1721
                            self.res_cat2_pkg10, case_sensitive=False)
1115
fae096bd02df 8865 attribute.generate_indicies doesn't handle multivalued info.category actions
Brock Pytlik <bpytlik@sun.com>
parents: 1102
diff changeset
  1722
                        self._search_op(api_obj, remote, "Developer/C",
fae096bd02df 8865 attribute.generate_indicies doesn't handle multivalued info.category actions
Brock Pytlik <bpytlik@sun.com>
parents: 1102
diff changeset
  1723
                            self.res_cat2_pkg10_2, case_sensitive=False)
fae096bd02df 8865 attribute.generate_indicies doesn't handle multivalued info.category actions
Brock Pytlik <bpytlik@sun.com>
parents: 1102
diff changeset
  1724
                        self._search_op(api_obj, remote, "Developer",
fae096bd02df 8865 attribute.generate_indicies doesn't handle multivalued info.category actions
Brock Pytlik <bpytlik@sun.com>
parents: 1102
diff changeset
  1725
                            self.res_cat2_pkg10_2, case_sensitive=False)
fae096bd02df 8865 attribute.generate_indicies doesn't handle multivalued info.category actions
Brock Pytlik <bpytlik@sun.com>
parents: 1102
diff changeset
  1726
                        self._search_op(api_obj, remote, "C",
fae096bd02df 8865 attribute.generate_indicies doesn't handle multivalued info.category actions
Brock Pytlik <bpytlik@sun.com>
parents: 1102
diff changeset
  1727
                            self.res_cat2_pkg10_2, case_sensitive=False)
fae096bd02df 8865 attribute.generate_indicies doesn't handle multivalued info.category actions
Brock Pytlik <bpytlik@sun.com>
parents: 1102
diff changeset
  1728
941
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
  1729
                def _run_cat3_tests(self, remote):
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
  1730
                        self._search_op(api_obj, remote, "foo",
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
  1731
                            self.res_cat3_pkg10,case_sensitive=False)
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
  1732
                        self._search_op(api_obj, remote, "baz",
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
  1733
                            self.res_cat3_pkg10, case_sensitive=False)
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
  1734
                        self._search_op(api_obj, remote, "asda",
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
  1735
                            self.res_cat3_pkg10, case_sensitive=False)
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
  1736
                        self._search_op(api_obj, remote,
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
  1737
                            "foo/bar/baz/bill/beam/asda", self.res_cat3_pkg10,
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
  1738
                            case_sensitive=False)
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
  1739
1127
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
  1740
                durl = self.dc.get_depot_url()
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
  1741
                self.pkgsend_bulk(durl, self.cat_pkg10)
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
  1742
                self.pkgsend_bulk(durl, self.cat2_pkg10)
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
  1743
                self.pkgsend_bulk(durl, self.cat3_pkg10)
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
  1744
                self.pkgsend_bulk(durl, self.bad_cat_pkg10)
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
  1745
                self.pkgsend_bulk(durl, self.bad_cat2_pkg10)
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
  1746
                self.image_create(durl)
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
  1747
                progresstracker = progress.NullProgressTracker()
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
  1748
                api_obj = api.ImageInterface(self.get_img_path(), API_VERSION,
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
  1749
                    progresstracker, lambda x: False, PKG_CLIENT_NAME)
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
  1750
941
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
  1751
                remote = True
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
  1752
                _run_cat_tests(self, remote)
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
  1753
                _run_cat2_tests(self, remote)
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
  1754
                _run_cat3_tests(self, remote)
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
  1755
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
  1756
                remote = False
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
  1757
                self._do_install(api_obj, ["cat"])
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
  1758
                _run_cat_tests(self, remote)
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
  1759
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
  1760
                self._do_install(api_obj, ["cat2"])
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
  1761
                _run_cat2_tests(self, remote)
1127
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
  1762
941
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
  1763
                self._do_install(api_obj, ["cat3"])
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
  1764
                _run_cat3_tests(self, remote)
1127
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
  1765
941
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
  1766
                self._do_install(api_obj, ["badcat"])
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
  1767
                self._do_install(api_obj, ["badcat2"])
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
  1768
                _run_cat_tests(self, remote)
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
  1769
                _run_cat2_tests(self, remote)
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
  1770
                _run_cat3_tests(self, remote)
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
  1771
1127
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
  1772
        def test_bug_7628(self):
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
  1773
                """Checks whether incremental update generates wrong
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
  1774
                additional lines."""
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
  1775
                durl = self.dc.get_depot_url()
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
  1776
                depotpath = self.dc.get_repodir()
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
  1777
                ind_dir = os.path.join(depotpath, "index")
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
  1778
                tok_file = os.path.join(ind_dir, ss.BYTE_OFFSET_FILE)
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
  1779
                main_file = os.path.join(ind_dir, ss.MAIN_FILE)
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
  1780
                self.pkgsend_bulk(durl, self.example_pkg10)
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
  1781
                time.sleep(1)
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
  1782
                fh = open(tok_file)
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
  1783
                tok_1 = fh.readlines()
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
  1784
                tok_len = len(tok_1)
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
  1785
                fh.close()
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
  1786
                fh = open(main_file)
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
  1787
                main_1 = fh.readlines()
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
  1788
                main_len = len(main_1)
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
  1789
                self.pkgsend_bulk(durl, self.example_pkg10, optional=False)
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
  1790
                time.sleep(1)
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
  1791
                fh = open(tok_file)
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
  1792
                tok_2 = fh.readlines()
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
  1793
                new_tok_len = len(tok_2)
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
  1794
                fh.close()
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
  1795
                fh = open(main_file)
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
  1796
                main_2 = fh.readlines()
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
  1797
                new_main_len = len(main_2)
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
  1798
                fh.close()
1431
62b6033670e4 10416 server catalog v1 support desired
Shawn Walker <srw@sun.com>
parents: 1423
diff changeset
  1799
                # Since the server now adds a set action for the FMRI to
62b6033670e4 10416 server catalog v1 support desired
Shawn Walker <srw@sun.com>
parents: 1423
diff changeset
  1800
                # manifests during publication, there should be one
62b6033670e4 10416 server catalog v1 support desired
Shawn Walker <srw@sun.com>
parents: 1423
diff changeset
  1801
                # additional line for the token file.
62b6033670e4 10416 server catalog v1 support desired
Shawn Walker <srw@sun.com>
parents: 1423
diff changeset
  1802
                self.assertEqual(new_tok_len, tok_len + 1)
62b6033670e4 10416 server catalog v1 support desired
Shawn Walker <srw@sun.com>
parents: 1423
diff changeset
  1803
                self.assertEqual(new_main_len, main_len + 1)
1127
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
  1804
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
  1805
        def test_bug_983(self):
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
  1806
                """Test for known bug 983."""
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
  1807
                durl = self.dc.get_depot_url()
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
  1808
                self.pkgsend_bulk(durl, self.bug_983_manifest)
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
  1809
                self.image_create(durl)
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
  1810
                progresstracker = progress.NullProgressTracker()
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
  1811
                api_obj = api.ImageInterface(self.get_img_path(), API_VERSION,
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
  1812
                    progresstracker, lambda x: False, PKG_CLIENT_NAME)
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
  1813
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
  1814
                self._search_op(api_obj, True, "gmake", self.res_bug_983)
1146
7c10e9798405 3322 'depend' search index has a syntax all its own
Brock Pytlik <bpytlik@sun.com>
parents: 1141
diff changeset
  1815
                self._search_op(api_obj, True, "[email protected]",
7c10e9798405 3322 'depend' search index has a syntax all its own
Brock Pytlik <bpytlik@sun.com>
parents: 1141
diff changeset
  1816
                    self.res_983_csl_dependency)
7c10e9798405 3322 'depend' search index has a syntax all its own
Brock Pytlik <bpytlik@sun.com>
parents: 1141
diff changeset
  1817
                self._search_op(api_obj, True, "SUNWcsl",
7c10e9798405 3322 'depend' search index has a syntax all its own
Brock Pytlik <bpytlik@sun.com>
parents: 1141
diff changeset
  1818
                    self.res_983_csl_dependency)
7c10e9798405 3322 'depend' search index has a syntax all its own
Brock Pytlik <bpytlik@sun.com>
parents: 1141
diff changeset
  1819
                self._search_op(api_obj, True, "[email protected]",
7c10e9798405 3322 'depend' search index has a syntax all its own
Brock Pytlik <bpytlik@sun.com>
parents: 1141
diff changeset
  1820
                    self.res_983_bar_dependency)
7c10e9798405 3322 'depend' search index has a syntax all its own
Brock Pytlik <bpytlik@sun.com>
parents: 1141
diff changeset
  1821
                self._search_op(api_obj, True, "SUNWtestbar",
7c10e9798405 3322 'depend' search index has a syntax all its own
Brock Pytlik <bpytlik@sun.com>
parents: 1141
diff changeset
  1822
                    self.res_983_bar_dependency)
7c10e9798405 3322 'depend' search index has a syntax all its own
Brock Pytlik <bpytlik@sun.com>
parents: 1141
diff changeset
  1823
                self._search_op(api_obj, True, "[email protected]",
7c10e9798405 3322 'depend' search index has a syntax all its own
Brock Pytlik <bpytlik@sun.com>
parents: 1141
diff changeset
  1824
                    self.res_983_foo_dependency)
7c10e9798405 3322 'depend' search index has a syntax all its own
Brock Pytlik <bpytlik@sun.com>
parents: 1141
diff changeset
  1825
                self._search_op(api_obj, True, "SUNWtestfoo",
7c10e9798405 3322 'depend' search index has a syntax all its own
Brock Pytlik <bpytlik@sun.com>
parents: 1141
diff changeset
  1826
                    self.res_983_foo_dependency)
7c10e9798405 3322 'depend' search index has a syntax all its own
Brock Pytlik <bpytlik@sun.com>
parents: 1141
diff changeset
  1827
                self._search_op(api_obj, True, "depend:require:",
7c10e9798405 3322 'depend' search index has a syntax all its own
Brock Pytlik <bpytlik@sun.com>
parents: 1141
diff changeset
  1828
                    self.res_983_csl_dependency | self.res_983_bar_dependency)
7c10e9798405 3322 'depend' search index has a syntax all its own
Brock Pytlik <bpytlik@sun.com>
parents: 1141
diff changeset
  1829
                self._search_op(api_obj, True, "depend:incorporate:",
7c10e9798405 3322 'depend' search index has a syntax all its own
Brock Pytlik <bpytlik@sun.com>
parents: 1141
diff changeset
  1830
                    self.res_983_foo_dependency)
7c10e9798405 3322 'depend' search index has a syntax all its own
Brock Pytlik <bpytlik@sun.com>
parents: 1141
diff changeset
  1831
                self._search_op(api_obj, True, "depend::",
7c10e9798405 3322 'depend' search index has a syntax all its own
Brock Pytlik <bpytlik@sun.com>
parents: 1141
diff changeset
  1832
                    self.res_983_csl_dependency | self.res_983_bar_dependency |
7c10e9798405 3322 'depend' search index has a syntax all its own
Brock Pytlik <bpytlik@sun.com>
parents: 1141
diff changeset
  1833
                    self.res_983_foo_dependency)
7c10e9798405 3322 'depend' search index has a syntax all its own
Brock Pytlik <bpytlik@sun.com>
parents: 1141
diff changeset
  1834
1286
2e5bb564a9e2 8948 search errors should make it clear that the rest of the command worked
Brock Pytlik <bpytlik@sun.com>
parents: 1271
diff changeset
  1835
        def test_bug_7534(self):
2e5bb564a9e2 8948 search errors should make it clear that the rest of the command worked
Brock Pytlik <bpytlik@sun.com>
parents: 1271
diff changeset
  1836
                """Tests that an automatic reindexing is detected by the test
2e5bb564a9e2 8948 search errors should make it clear that the rest of the command worked
Brock Pytlik <bpytlik@sun.com>
parents: 1271
diff changeset
  1837
                suite."""
2e5bb564a9e2 8948 search errors should make it clear that the rest of the command worked
Brock Pytlik <bpytlik@sun.com>
parents: 1271
diff changeset
  1838
                durl = self.dc.get_depot_url()
2e5bb564a9e2 8948 search errors should make it clear that the rest of the command worked
Brock Pytlik <bpytlik@sun.com>
parents: 1271
diff changeset
  1839
                self.pkgsend_bulk(durl, self.example_pkg10)
2e5bb564a9e2 8948 search errors should make it clear that the rest of the command worked
Brock Pytlik <bpytlik@sun.com>
parents: 1271
diff changeset
  1840
                self.image_create(durl)
2e5bb564a9e2 8948 search errors should make it clear that the rest of the command worked
Brock Pytlik <bpytlik@sun.com>
parents: 1271
diff changeset
  1841
                progresstracker = progress.NullProgressTracker()
2e5bb564a9e2 8948 search errors should make it clear that the rest of the command worked
Brock Pytlik <bpytlik@sun.com>
parents: 1271
diff changeset
  1842
                api_obj = api.ImageInterface(self.get_img_path(), API_VERSION,
2e5bb564a9e2 8948 search errors should make it clear that the rest of the command worked
Brock Pytlik <bpytlik@sun.com>
parents: 1271
diff changeset
  1843
                    progresstracker, lambda x: True, PKG_CLIENT_NAME)
2e5bb564a9e2 8948 search errors should make it clear that the rest of the command worked
Brock Pytlik <bpytlik@sun.com>
parents: 1271
diff changeset
  1844
2e5bb564a9e2 8948 search errors should make it clear that the rest of the command worked
Brock Pytlik <bpytlik@sun.com>
parents: 1271
diff changeset
  1845
                index_dir = os.path.join(self.img_path, "var","pkg","index")
2e5bb564a9e2 8948 search errors should make it clear that the rest of the command worked
Brock Pytlik <bpytlik@sun.com>
parents: 1271
diff changeset
  1846
2e5bb564a9e2 8948 search errors should make it clear that the rest of the command worked
Brock Pytlik <bpytlik@sun.com>
parents: 1271
diff changeset
  1847
                orig_fn = os.path.join(index_dir,
2e5bb564a9e2 8948 search errors should make it clear that the rest of the command worked
Brock Pytlik <bpytlik@sun.com>
parents: 1271
diff changeset
  1848
                    query_parser.TermQuery._global_data_dict.values()[0].\
2e5bb564a9e2 8948 search errors should make it clear that the rest of the command worked
Brock Pytlik <bpytlik@sun.com>
parents: 1271
diff changeset
  1849
                    get_file_name())
2e5bb564a9e2 8948 search errors should make it clear that the rest of the command worked
Brock Pytlik <bpytlik@sun.com>
parents: 1271
diff changeset
  1850
                dest_fn = orig_fn + "TMP"
1431
62b6033670e4 10416 server catalog v1 support desired
Shawn Walker <srw@sun.com>
parents: 1423
diff changeset
  1851
1286
2e5bb564a9e2 8948 search errors should make it clear that the rest of the command worked
Brock Pytlik <bpytlik@sun.com>
parents: 1271
diff changeset
  1852
                self._do_install(api_obj, ["example_pkg"])
2e5bb564a9e2 8948 search errors should make it clear that the rest of the command worked
Brock Pytlik <bpytlik@sun.com>
parents: 1271
diff changeset
  1853
                api_obj.rebuild_search_index()
2e5bb564a9e2 8948 search errors should make it clear that the rest of the command worked
Brock Pytlik <bpytlik@sun.com>
parents: 1271
diff changeset
  1854
2e5bb564a9e2 8948 search errors should make it clear that the rest of the command worked
Brock Pytlik <bpytlik@sun.com>
parents: 1271
diff changeset
  1855
                portable.rename(orig_fn, dest_fn)
2e5bb564a9e2 8948 search errors should make it clear that the rest of the command worked
Brock Pytlik <bpytlik@sun.com>
parents: 1271
diff changeset
  1856
                self.assertRaises(api_errors.WrapSuccessfulIndexingException,
2e5bb564a9e2 8948 search errors should make it clear that the rest of the command worked
Brock Pytlik <bpytlik@sun.com>
parents: 1271
diff changeset
  1857
                    self._do_uninstall, api_obj, ["example_pkg"])
2e5bb564a9e2 8948 search errors should make it clear that the rest of the command worked
Brock Pytlik <bpytlik@sun.com>
parents: 1271
diff changeset
  1858
2e5bb564a9e2 8948 search errors should make it clear that the rest of the command worked
Brock Pytlik <bpytlik@sun.com>
parents: 1271
diff changeset
  1859
        def test_bug_9729_1(self):
2e5bb564a9e2 8948 search errors should make it clear that the rest of the command worked
Brock Pytlik <bpytlik@sun.com>
parents: 1271
diff changeset
  1860
                """Test that installing more than
2e5bb564a9e2 8948 search errors should make it clear that the rest of the command worked
Brock Pytlik <bpytlik@sun.com>
parents: 1271
diff changeset
  1861
                indexer.MAX_ADDED_NUMBER_PACKAGES packages at a time doesn't
2e5bb564a9e2 8948 search errors should make it clear that the rest of the command worked
Brock Pytlik <bpytlik@sun.com>
parents: 1271
diff changeset
  1862
                cause any type of indexing error."""
2e5bb564a9e2 8948 search errors should make it clear that the rest of the command worked
Brock Pytlik <bpytlik@sun.com>
parents: 1271
diff changeset
  1863
                durl = self.dc.get_depot_url()
2e5bb564a9e2 8948 search errors should make it clear that the rest of the command worked
Brock Pytlik <bpytlik@sun.com>
parents: 1271
diff changeset
  1864
                pkg_list = []
2e5bb564a9e2 8948 search errors should make it clear that the rest of the command worked
Brock Pytlik <bpytlik@sun.com>
parents: 1271
diff changeset
  1865
                for i in range(0, indexer.MAX_ADDED_NUMBER_PACKAGES + 1):
2e5bb564a9e2 8948 search errors should make it clear that the rest of the command worked
Brock Pytlik <bpytlik@sun.com>
parents: 1271
diff changeset
  1866
                        self.pkgsend_bulk(durl,
2e5bb564a9e2 8948 search errors should make it clear that the rest of the command worked
Brock Pytlik <bpytlik@sun.com>
parents: 1271
diff changeset
  1867
                            "open pkg%[email protected],5.11-0\nclose\n" % i)
2e5bb564a9e2 8948 search errors should make it clear that the rest of the command worked
Brock Pytlik <bpytlik@sun.com>
parents: 1271
diff changeset
  1868
                        pkg_list.append("pkg%s" % i)
2e5bb564a9e2 8948 search errors should make it clear that the rest of the command worked
Brock Pytlik <bpytlik@sun.com>
parents: 1271
diff changeset
  1869
                self.image_create(durl)
2e5bb564a9e2 8948 search errors should make it clear that the rest of the command worked
Brock Pytlik <bpytlik@sun.com>
parents: 1271
diff changeset
  1870
                progresstracker = progress.NullProgressTracker()
2e5bb564a9e2 8948 search errors should make it clear that the rest of the command worked
Brock Pytlik <bpytlik@sun.com>
parents: 1271
diff changeset
  1871
                api_obj = api.ImageInterface(self.get_img_path(), API_VERSION,
2e5bb564a9e2 8948 search errors should make it clear that the rest of the command worked
Brock Pytlik <bpytlik@sun.com>
parents: 1271
diff changeset
  1872
                    progresstracker, lambda x: True, PKG_CLIENT_NAME)
2e5bb564a9e2 8948 search errors should make it clear that the rest of the command worked
Brock Pytlik <bpytlik@sun.com>
parents: 1271
diff changeset
  1873
                self._do_install(api_obj, pkg_list)
2e5bb564a9e2 8948 search errors should make it clear that the rest of the command worked
Brock Pytlik <bpytlik@sun.com>
parents: 1271
diff changeset
  1874
2e5bb564a9e2 8948 search errors should make it clear that the rest of the command worked
Brock Pytlik <bpytlik@sun.com>
parents: 1271
diff changeset
  1875
        def test_bug_9729_2(self):
2e5bb564a9e2 8948 search errors should make it clear that the rest of the command worked
Brock Pytlik <bpytlik@sun.com>
parents: 1271
diff changeset
  1876
                """Test that installing more than
2e5bb564a9e2 8948 search errors should make it clear that the rest of the command worked
Brock Pytlik <bpytlik@sun.com>
parents: 1271
diff changeset
  1877
                indexer.MAX_ADDED_NUMBER_PACKAGES packages one after another
2e5bb564a9e2 8948 search errors should make it clear that the rest of the command worked
Brock Pytlik <bpytlik@sun.com>
parents: 1271
diff changeset
  1878
                doesn't cause any type of indexing error."""
1354
22d755acef3d 11104 fast add not being cleared correctly
Brock Pytlik <bpytlik@sun.com>
parents: 1352
diff changeset
  1879
                def _remove_extra_info(v):
1431
62b6033670e4 10416 server catalog v1 support desired
Shawn Walker <srw@sun.com>
parents: 1423
diff changeset
  1880
                        return v.split("-")[0]
1286
2e5bb564a9e2 8948 search errors should make it clear that the rest of the command worked
Brock Pytlik <bpytlik@sun.com>
parents: 1271
diff changeset
  1881
                durl = self.dc.get_depot_url()
2e5bb564a9e2 8948 search errors should make it clear that the rest of the command worked
Brock Pytlik <bpytlik@sun.com>
parents: 1271
diff changeset
  1882
                pkg_list = []
1354
22d755acef3d 11104 fast add not being cleared correctly
Brock Pytlik <bpytlik@sun.com>
parents: 1352
diff changeset
  1883
                for i in range(0, indexer.MAX_ADDED_NUMBER_PACKAGES + 3):
1286
2e5bb564a9e2 8948 search errors should make it clear that the rest of the command worked
Brock Pytlik <bpytlik@sun.com>
parents: 1271
diff changeset
  1884
                        self.pkgsend_bulk(durl,
2e5bb564a9e2 8948 search errors should make it clear that the rest of the command worked
Brock Pytlik <bpytlik@sun.com>
parents: 1271
diff changeset
  1885
                            "open pkg%[email protected],5.11-0\nclose\n" % i)
2e5bb564a9e2 8948 search errors should make it clear that the rest of the command worked
Brock Pytlik <bpytlik@sun.com>
parents: 1271
diff changeset
  1886
                        pkg_list.append("pkg%s" % i)
2e5bb564a9e2 8948 search errors should make it clear that the rest of the command worked
Brock Pytlik <bpytlik@sun.com>
parents: 1271
diff changeset
  1887
                self.image_create(durl)
2e5bb564a9e2 8948 search errors should make it clear that the rest of the command worked
Brock Pytlik <bpytlik@sun.com>
parents: 1271
diff changeset
  1888
                progresstracker = progress.NullProgressTracker()
2e5bb564a9e2 8948 search errors should make it clear that the rest of the command worked
Brock Pytlik <bpytlik@sun.com>
parents: 1271
diff changeset
  1889
                api_obj = api.ImageInterface(self.get_img_path(), API_VERSION,
2e5bb564a9e2 8948 search errors should make it clear that the rest of the command worked
Brock Pytlik <bpytlik@sun.com>
parents: 1271
diff changeset
  1890
                    progresstracker, lambda x: True, PKG_CLIENT_NAME)
1354
22d755acef3d 11104 fast add not being cleared correctly
Brock Pytlik <bpytlik@sun.com>
parents: 1352
diff changeset
  1891
                fast_add_loc = os.path.join(self._get_index_dirs()[0],
22d755acef3d 11104 fast add not being cleared correctly
Brock Pytlik <bpytlik@sun.com>
parents: 1352
diff changeset
  1892
                    "fast_add.v1")
22d755acef3d 11104 fast add not being cleared correctly
Brock Pytlik <bpytlik@sun.com>
parents: 1352
diff changeset
  1893
                fast_remove_loc = os.path.join(self._get_index_dirs()[0],
22d755acef3d 11104 fast add not being cleared correctly
Brock Pytlik <bpytlik@sun.com>
parents: 1352
diff changeset
  1894
                    "fast_remove.v1")
22d755acef3d 11104 fast add not being cleared correctly
Brock Pytlik <bpytlik@sun.com>
parents: 1352
diff changeset
  1895
                api_obj.rebuild_search_index()
1286
2e5bb564a9e2 8948 search errors should make it clear that the rest of the command worked
Brock Pytlik <bpytlik@sun.com>
parents: 1271
diff changeset
  1896
                for p in pkg_list:
2e5bb564a9e2 8948 search errors should make it clear that the rest of the command worked
Brock Pytlik <bpytlik@sun.com>
parents: 1271
diff changeset
  1897
                        self._do_install(api_obj, [p])
1354
22d755acef3d 11104 fast add not being cleared correctly
Brock Pytlik <bpytlik@sun.com>
parents: 1352
diff changeset
  1898
                # Test for bug 11104. The fast_add.v1 file was not being updated
22d755acef3d 11104 fast add not being cleared correctly
Brock Pytlik <bpytlik@sun.com>
parents: 1352
diff changeset
  1899
                # correctly by install or image update, it was growing with
22d755acef3d 11104 fast add not being cleared correctly
Brock Pytlik <bpytlik@sun.com>
parents: 1352
diff changeset
  1900
                # each modification.
22d755acef3d 11104 fast add not being cleared correctly
Brock Pytlik <bpytlik@sun.com>
parents: 1352
diff changeset
  1901
                self._check(set((
22d755acef3d 11104 fast add not being cleared correctly
Brock Pytlik <bpytlik@sun.com>
parents: 1352
diff changeset
  1902
                    _remove_extra_info(v)
22d755acef3d 11104 fast add not being cleared correctly
Brock Pytlik <bpytlik@sun.com>
parents: 1352
diff changeset
  1903
                    for v in self._get_lines(fast_add_loc)
22d755acef3d 11104 fast add not being cleared correctly
Brock Pytlik <bpytlik@sun.com>
parents: 1352
diff changeset
  1904
                    )), self.fast_add_after_install)
22d755acef3d 11104 fast add not being cleared correctly
Brock Pytlik <bpytlik@sun.com>
parents: 1352
diff changeset
  1905
                self._check(set((
22d755acef3d 11104 fast add not being cleared correctly
Brock Pytlik <bpytlik@sun.com>
parents: 1352
diff changeset
  1906
                    _remove_extra_info(v)
22d755acef3d 11104 fast add not being cleared correctly
Brock Pytlik <bpytlik@sun.com>
parents: 1352
diff changeset
  1907
                    for v in self._get_lines(fast_remove_loc)
22d755acef3d 11104 fast add not being cleared correctly
Brock Pytlik <bpytlik@sun.com>
parents: 1352
diff changeset
  1908
                    )), self.fast_remove_after_install)
22d755acef3d 11104 fast add not being cleared correctly
Brock Pytlik <bpytlik@sun.com>
parents: 1352
diff changeset
  1909
                # Now check that image update also handles fast_add
22d755acef3d 11104 fast add not being cleared correctly
Brock Pytlik <bpytlik@sun.com>
parents: 1352
diff changeset
  1910
                # appropriately when a small number of packages have changed.
22d755acef3d 11104 fast add not being cleared correctly
Brock Pytlik <bpytlik@sun.com>
parents: 1352
diff changeset
  1911
                for i in range(0, 2):
22d755acef3d 11104 fast add not being cleared correctly
Brock Pytlik <bpytlik@sun.com>
parents: 1352
diff changeset
  1912
                        self.pkgsend_bulk(durl,
22d755acef3d 11104 fast add not being cleared correctly
Brock Pytlik <bpytlik@sun.com>
parents: 1352
diff changeset
  1913
                            "open pkg%[email protected],5.11-0\nclose\n" % i)
22d755acef3d 11104 fast add not being cleared correctly
Brock Pytlik <bpytlik@sun.com>
parents: 1352
diff changeset
  1914
                        pkg_list.append("pkg%s" % i)
22d755acef3d 11104 fast add not being cleared correctly
Brock Pytlik <bpytlik@sun.com>
parents: 1352
diff changeset
  1915
                api_obj.refresh(immediate=True)
22d755acef3d 11104 fast add not being cleared correctly
Brock Pytlik <bpytlik@sun.com>
parents: 1352
diff changeset
  1916
                self._do_image_update(api_obj)
22d755acef3d 11104 fast add not being cleared correctly
Brock Pytlik <bpytlik@sun.com>
parents: 1352
diff changeset
  1917
                self._check(set((
22d755acef3d 11104 fast add not being cleared correctly
Brock Pytlik <bpytlik@sun.com>
parents: 1352
diff changeset
  1918
                    _remove_extra_info(v)
22d755acef3d 11104 fast add not being cleared correctly
Brock Pytlik <bpytlik@sun.com>
parents: 1352
diff changeset
  1919
                    for v in self._get_lines(fast_add_loc)
22d755acef3d 11104 fast add not being cleared correctly
Brock Pytlik <bpytlik@sun.com>
parents: 1352
diff changeset
  1920
                    )), self.fast_add_after_first_update)
22d755acef3d 11104 fast add not being cleared correctly
Brock Pytlik <bpytlik@sun.com>
parents: 1352
diff changeset
  1921
22d755acef3d 11104 fast add not being cleared correctly
Brock Pytlik <bpytlik@sun.com>
parents: 1352
diff changeset
  1922
                self._check(set((
22d755acef3d 11104 fast add not being cleared correctly
Brock Pytlik <bpytlik@sun.com>
parents: 1352
diff changeset
  1923
                    _remove_extra_info(v)
22d755acef3d 11104 fast add not being cleared correctly
Brock Pytlik <bpytlik@sun.com>
parents: 1352
diff changeset
  1924
                    for v in self._get_lines(fast_remove_loc)
22d755acef3d 11104 fast add not being cleared correctly
Brock Pytlik <bpytlik@sun.com>
parents: 1352
diff changeset
  1925
                    )), self.fast_remove_after_first_update)
22d755acef3d 11104 fast add not being cleared correctly
Brock Pytlik <bpytlik@sun.com>
parents: 1352
diff changeset
  1926
                # Now check that image update also handles fast_add
22d755acef3d 11104 fast add not being cleared correctly
Brock Pytlik <bpytlik@sun.com>
parents: 1352
diff changeset
  1927
                # appropriately when a large number of packages have changed.
22d755acef3d 11104 fast add not being cleared correctly
Brock Pytlik <bpytlik@sun.com>
parents: 1352
diff changeset
  1928
                for i in range(3, indexer.MAX_ADDED_NUMBER_PACKAGES + 3):
22d755acef3d 11104 fast add not being cleared correctly
Brock Pytlik <bpytlik@sun.com>
parents: 1352
diff changeset
  1929
                        self.pkgsend_bulk(durl,
22d755acef3d 11104 fast add not being cleared correctly
Brock Pytlik <bpytlik@sun.com>
parents: 1352
diff changeset
  1930
                            "open pkg%[email protected],5.11-0\nclose\n" % i)
22d755acef3d 11104 fast add not being cleared correctly
Brock Pytlik <bpytlik@sun.com>
parents: 1352
diff changeset
  1931
                        pkg_list.append("pkg%s" % i)
22d755acef3d 11104 fast add not being cleared correctly
Brock Pytlik <bpytlik@sun.com>
parents: 1352
diff changeset
  1932
                api_obj.refresh(immediate=True)
22d755acef3d 11104 fast add not being cleared correctly
Brock Pytlik <bpytlik@sun.com>
parents: 1352
diff changeset
  1933
                self._do_image_update(api_obj)
22d755acef3d 11104 fast add not being cleared correctly
Brock Pytlik <bpytlik@sun.com>
parents: 1352
diff changeset
  1934
                self._check(set((
22d755acef3d 11104 fast add not being cleared correctly
Brock Pytlik <bpytlik@sun.com>
parents: 1352
diff changeset
  1935
                    _remove_extra_info(v)
22d755acef3d 11104 fast add not being cleared correctly
Brock Pytlik <bpytlik@sun.com>
parents: 1352
diff changeset
  1936
                    for v in self._get_lines(fast_add_loc)
22d755acef3d 11104 fast add not being cleared correctly
Brock Pytlik <bpytlik@sun.com>
parents: 1352
diff changeset
  1937
                    )), self.fast_add_after_second_update)
22d755acef3d 11104 fast add not being cleared correctly
Brock Pytlik <bpytlik@sun.com>
parents: 1352
diff changeset
  1938
                self._check(set((
22d755acef3d 11104 fast add not being cleared correctly
Brock Pytlik <bpytlik@sun.com>
parents: 1352
diff changeset
  1939
                    _remove_extra_info(v)
22d755acef3d 11104 fast add not being cleared correctly
Brock Pytlik <bpytlik@sun.com>
parents: 1352
diff changeset
  1940
                    for v in self._get_lines(fast_remove_loc)
22d755acef3d 11104 fast add not being cleared correctly
Brock Pytlik <bpytlik@sun.com>
parents: 1352
diff changeset
  1941
                    )), self.fast_remove_after_second_update)
1286
2e5bb564a9e2 8948 search errors should make it clear that the rest of the command worked
Brock Pytlik <bpytlik@sun.com>
parents: 1271
diff changeset
  1942
1291
0f82f71cbf19 9845 Query.fromstr needs more error handling
Brock Pytlik <bpytlik@sun.com>
parents: 1286
diff changeset
  1943
        def test_bug_9845_01(self):
0f82f71cbf19 9845 Query.fromstr needs more error handling
Brock Pytlik <bpytlik@sun.com>
parents: 1286
diff changeset
  1944
                """Test that a corrupt query doesn't break the server."""
0f82f71cbf19 9845 Query.fromstr needs more error handling
Brock Pytlik <bpytlik@sun.com>
parents: 1286
diff changeset
  1945
                durl = self.dc.get_depot_url()
0f82f71cbf19 9845 Query.fromstr needs more error handling
Brock Pytlik <bpytlik@sun.com>
parents: 1286
diff changeset
  1946
                expected_string = _("A query is expected to have five fields: "
0f82f71cbf19 9845 Query.fromstr needs more error handling
Brock Pytlik <bpytlik@sun.com>
parents: 1286
diff changeset
  1947
                    "case sensitivity, return type, number of results to "
0f82f71cbf19 9845 Query.fromstr needs more error handling
Brock Pytlik <bpytlik@sun.com>
parents: 1286
diff changeset
  1948
                    "return, the number at which to start returning results, "
0f82f71cbf19 9845 Query.fromstr needs more error handling
Brock Pytlik <bpytlik@sun.com>
parents: 1286
diff changeset
  1949
                    "and the text of the query.  The query provided lacked at "
0f82f71cbf19 9845 Query.fromstr needs more error handling
Brock Pytlik <bpytlik@sun.com>
parents: 1286
diff changeset
  1950
                    "least one of those fields:")
0f82f71cbf19 9845 Query.fromstr needs more error handling
Brock Pytlik <bpytlik@sun.com>
parents: 1286
diff changeset
  1951
                expected_code = 404
0f82f71cbf19 9845 Query.fromstr needs more error handling
Brock Pytlik <bpytlik@sun.com>
parents: 1286
diff changeset
  1952
                q_str = "foo"
0f82f71cbf19 9845 Query.fromstr needs more error handling
Brock Pytlik <bpytlik@sun.com>
parents: 1286
diff changeset
  1953
                self.validateAssertRaises(urllib2.HTTPError,
0f82f71cbf19 9845 Query.fromstr needs more error handling
Brock Pytlik <bpytlik@sun.com>
parents: 1286
diff changeset
  1954
                    lambda x: self._check_err(x, expected_string,
0f82f71cbf19 9845 Query.fromstr needs more error handling
Brock Pytlik <bpytlik@sun.com>
parents: 1286
diff changeset
  1955
                        expected_code),
0f82f71cbf19 9845 Query.fromstr needs more error handling
Brock Pytlik <bpytlik@sun.com>
parents: 1286
diff changeset
  1956
                    urllib2.urlopen, durl + "/search/1/" + q_str)
0f82f71cbf19 9845 Query.fromstr needs more error handling
Brock Pytlik <bpytlik@sun.com>
parents: 1286
diff changeset
  1957
0f82f71cbf19 9845 Query.fromstr needs more error handling
Brock Pytlik <bpytlik@sun.com>
parents: 1286
diff changeset
  1958
        def test_bug_9845_02(self):
0f82f71cbf19 9845 Query.fromstr needs more error handling
Brock Pytlik <bpytlik@sun.com>
parents: 1286
diff changeset
  1959
                """Test that a corrupt case_sensitive value doesn't break the "
0f82f71cbf19 9845 Query.fromstr needs more error handling
Brock Pytlik <bpytlik@sun.com>
parents: 1286
diff changeset
  1960
                server."""
0f82f71cbf19 9845 Query.fromstr needs more error handling
Brock Pytlik <bpytlik@sun.com>
parents: 1286
diff changeset
  1961
                durl = self.dc.get_depot_url()
0f82f71cbf19 9845 Query.fromstr needs more error handling
Brock Pytlik <bpytlik@sun.com>
parents: 1286
diff changeset
  1962
                expected_string = _("%(name)s had a bad value of '%(bv)s'") % {
0f82f71cbf19 9845 Query.fromstr needs more error handling
Brock Pytlik <bpytlik@sun.com>
parents: 1286
diff changeset
  1963
                    "name": "case_sensitive",
0f82f71cbf19 9845 Query.fromstr needs more error handling
Brock Pytlik <bpytlik@sun.com>
parents: 1286
diff changeset
  1964
                    "bv": "FAlse"
0f82f71cbf19 9845 Query.fromstr needs more error handling
Brock Pytlik <bpytlik@sun.com>
parents: 1286
diff changeset
  1965
                }
0f82f71cbf19 9845 Query.fromstr needs more error handling
Brock Pytlik <bpytlik@sun.com>
parents: 1286
diff changeset
  1966
                expected_code = 404
0f82f71cbf19 9845 Query.fromstr needs more error handling
Brock Pytlik <bpytlik@sun.com>
parents: 1286
diff changeset
  1967
                q_str = "FAlse_2_None_None_foo"
0f82f71cbf19 9845 Query.fromstr needs more error handling
Brock Pytlik <bpytlik@sun.com>
parents: 1286
diff changeset
  1968
                self.validateAssertRaises(urllib2.HTTPError,
0f82f71cbf19 9845 Query.fromstr needs more error handling
Brock Pytlik <bpytlik@sun.com>
parents: 1286
diff changeset
  1969
                    lambda x: self._check_err(x, expected_string,
0f82f71cbf19 9845 Query.fromstr needs more error handling
Brock Pytlik <bpytlik@sun.com>
parents: 1286
diff changeset
  1970
                        expected_code),
0f82f71cbf19 9845 Query.fromstr needs more error handling
Brock Pytlik <bpytlik@sun.com>
parents: 1286
diff changeset
  1971
                    urllib2.urlopen, durl + "/search/1/" + q_str)
0f82f71cbf19 9845 Query.fromstr needs more error handling
Brock Pytlik <bpytlik@sun.com>
parents: 1286
diff changeset
  1972
1431
62b6033670e4 10416 server catalog v1 support desired
Shawn Walker <srw@sun.com>
parents: 1423
diff changeset
  1973
        def test_bug_9845_03(self):
1291
0f82f71cbf19 9845 Query.fromstr needs more error handling
Brock Pytlik <bpytlik@sun.com>
parents: 1286
diff changeset
  1974
                """Test that a corrupt return_type value doesn't break the "
0f82f71cbf19 9845 Query.fromstr needs more error handling
Brock Pytlik <bpytlik@sun.com>
parents: 1286
diff changeset
  1975
                server."""
0f82f71cbf19 9845 Query.fromstr needs more error handling
Brock Pytlik <bpytlik@sun.com>
parents: 1286
diff changeset
  1976
                durl = self.dc.get_depot_url()
0f82f71cbf19 9845 Query.fromstr needs more error handling
Brock Pytlik <bpytlik@sun.com>
parents: 1286
diff changeset
  1977
                expected_string = _("%(name)s had a bad value of '%(bv)s'") % {
0f82f71cbf19 9845 Query.fromstr needs more error handling
Brock Pytlik <bpytlik@sun.com>
parents: 1286
diff changeset
  1978
                    "name": "return_type",
0f82f71cbf19 9845 Query.fromstr needs more error handling
Brock Pytlik <bpytlik@sun.com>
parents: 1286
diff changeset
  1979
                    "bv": "3"
0f82f71cbf19 9845 Query.fromstr needs more error handling
Brock Pytlik <bpytlik@sun.com>
parents: 1286
diff changeset
  1980
                }
0f82f71cbf19 9845 Query.fromstr needs more error handling
Brock Pytlik <bpytlik@sun.com>
parents: 1286
diff changeset
  1981
                expected_code = 404
0f82f71cbf19 9845 Query.fromstr needs more error handling
Brock Pytlik <bpytlik@sun.com>
parents: 1286
diff changeset
  1982
                q_str = "False_3_None_None_foo"
0f82f71cbf19 9845 Query.fromstr needs more error handling
Brock Pytlik <bpytlik@sun.com>
parents: 1286
diff changeset
  1983
                self.validateAssertRaises(urllib2.HTTPError,
0f82f71cbf19 9845 Query.fromstr needs more error handling
Brock Pytlik <bpytlik@sun.com>
parents: 1286
diff changeset
  1984
                    lambda x: self._check_err(x, expected_string,
0f82f71cbf19 9845 Query.fromstr needs more error handling
Brock Pytlik <bpytlik@sun.com>
parents: 1286
diff changeset
  1985
                        expected_code),
0f82f71cbf19 9845 Query.fromstr needs more error handling
Brock Pytlik <bpytlik@sun.com>
parents: 1286
diff changeset
  1986
                    urllib2.urlopen, durl + "/search/1/" + q_str)
0f82f71cbf19 9845 Query.fromstr needs more error handling
Brock Pytlik <bpytlik@sun.com>
parents: 1286
diff changeset
  1987
0f82f71cbf19 9845 Query.fromstr needs more error handling
Brock Pytlik <bpytlik@sun.com>
parents: 1286
diff changeset
  1988
        def test_bug_9845_04(self):
0f82f71cbf19 9845 Query.fromstr needs more error handling
Brock Pytlik <bpytlik@sun.com>
parents: 1286
diff changeset
  1989
                """Test that a corrupt return_type value doesn't break the "
0f82f71cbf19 9845 Query.fromstr needs more error handling
Brock Pytlik <bpytlik@sun.com>
parents: 1286
diff changeset
  1990
                server."""
0f82f71cbf19 9845 Query.fromstr needs more error handling
Brock Pytlik <bpytlik@sun.com>
parents: 1286
diff changeset
  1991
                durl = self.dc.get_depot_url()
0f82f71cbf19 9845 Query.fromstr needs more error handling
Brock Pytlik <bpytlik@sun.com>
parents: 1286
diff changeset
  1992
                expected_string = _("%(name)s had a bad value of '%(bv)s'") % {
0f82f71cbf19 9845 Query.fromstr needs more error handling
Brock Pytlik <bpytlik@sun.com>
parents: 1286
diff changeset
  1993
                    "name": "return_type",
0f82f71cbf19 9845 Query.fromstr needs more error handling
Brock Pytlik <bpytlik@sun.com>
parents: 1286
diff changeset
  1994
                    "bv": "A"
0f82f71cbf19 9845 Query.fromstr needs more error handling
Brock Pytlik <bpytlik@sun.com>
parents: 1286
diff changeset
  1995
                }
0f82f71cbf19 9845 Query.fromstr needs more error handling
Brock Pytlik <bpytlik@sun.com>
parents: 1286
diff changeset
  1996
                expected_code = 404
0f82f71cbf19 9845 Query.fromstr needs more error handling
Brock Pytlik <bpytlik@sun.com>
parents: 1286
diff changeset
  1997
                q_str = "False_A_None_None_foo"
0f82f71cbf19 9845 Query.fromstr needs more error handling
Brock Pytlik <bpytlik@sun.com>
parents: 1286
diff changeset
  1998
                self.validateAssertRaises(urllib2.HTTPError,
0f82f71cbf19 9845 Query.fromstr needs more error handling
Brock Pytlik <bpytlik@sun.com>
parents: 1286
diff changeset
  1999
                    lambda x: self._check_err(x, expected_string,
0f82f71cbf19 9845 Query.fromstr needs more error handling
Brock Pytlik <bpytlik@sun.com>
parents: 1286
diff changeset
  2000
                        expected_code),
0f82f71cbf19 9845 Query.fromstr needs more error handling
Brock Pytlik <bpytlik@sun.com>
parents: 1286
diff changeset
  2001
                    urllib2.urlopen, durl + "/search/1/" + q_str)
0f82f71cbf19 9845 Query.fromstr needs more error handling
Brock Pytlik <bpytlik@sun.com>
parents: 1286
diff changeset
  2002
0f82f71cbf19 9845 Query.fromstr needs more error handling
Brock Pytlik <bpytlik@sun.com>
parents: 1286
diff changeset
  2003
        def test_bug_9845_05(self):
0f82f71cbf19 9845 Query.fromstr needs more error handling
Brock Pytlik <bpytlik@sun.com>
parents: 1286
diff changeset
  2004
                """Test that a corrupt num_to_return value doesn't break the "
0f82f71cbf19 9845 Query.fromstr needs more error handling
Brock Pytlik <bpytlik@sun.com>
parents: 1286
diff changeset
  2005
                server."""
0f82f71cbf19 9845 Query.fromstr needs more error handling
Brock Pytlik <bpytlik@sun.com>
parents: 1286
diff changeset
  2006
                durl = self.dc.get_depot_url()
0f82f71cbf19 9845 Query.fromstr needs more error handling
Brock Pytlik <bpytlik@sun.com>
parents: 1286
diff changeset
  2007
                expected_string = _("%(name)s had a bad value of '%(bv)s'") % {
0f82f71cbf19 9845 Query.fromstr needs more error handling
Brock Pytlik <bpytlik@sun.com>
parents: 1286
diff changeset
  2008
                    "name": "num_to_return",
0f82f71cbf19 9845 Query.fromstr needs more error handling
Brock Pytlik <bpytlik@sun.com>
parents: 1286
diff changeset
  2009
                    "bv": "NOne"
0f82f71cbf19 9845 Query.fromstr needs more error handling
Brock Pytlik <bpytlik@sun.com>
parents: 1286
diff changeset
  2010
                }
0f82f71cbf19 9845 Query.fromstr needs more error handling
Brock Pytlik <bpytlik@sun.com>
parents: 1286
diff changeset
  2011
                expected_code = 404
0f82f71cbf19 9845 Query.fromstr needs more error handling
Brock Pytlik <bpytlik@sun.com>
parents: 1286
diff changeset
  2012
                q_str = "False_2_NOne_None_foo"
0f82f71cbf19 9845 Query.fromstr needs more error handling
Brock Pytlik <bpytlik@sun.com>
parents: 1286
diff changeset
  2013
                self.validateAssertRaises(urllib2.HTTPError,
0f82f71cbf19 9845 Query.fromstr needs more error handling
Brock Pytlik <bpytlik@sun.com>
parents: 1286
diff changeset
  2014
                    lambda x: self._check_err(x, expected_string,
0f82f71cbf19 9845 Query.fromstr needs more error handling
Brock Pytlik <bpytlik@sun.com>
parents: 1286
diff changeset
  2015
                        expected_code),
0f82f71cbf19 9845 Query.fromstr needs more error handling
Brock Pytlik <bpytlik@sun.com>
parents: 1286
diff changeset
  2016
                    urllib2.urlopen, durl + "/search/1/" + q_str)
0f82f71cbf19 9845 Query.fromstr needs more error handling
Brock Pytlik <bpytlik@sun.com>
parents: 1286
diff changeset
  2017
0f82f71cbf19 9845 Query.fromstr needs more error handling
Brock Pytlik <bpytlik@sun.com>
parents: 1286
diff changeset
  2018
        def test_bug_9845_06(self):
0f82f71cbf19 9845 Query.fromstr needs more error handling
Brock Pytlik <bpytlik@sun.com>
parents: 1286
diff changeset
  2019
                """Test that a corrupt start_point value doesn't break the "
0f82f71cbf19 9845 Query.fromstr needs more error handling
Brock Pytlik <bpytlik@sun.com>
parents: 1286
diff changeset
  2020
                server."""
0f82f71cbf19 9845 Query.fromstr needs more error handling
Brock Pytlik <bpytlik@sun.com>
parents: 1286
diff changeset
  2021
                durl = self.dc.get_depot_url()
0f82f71cbf19 9845 Query.fromstr needs more error handling
Brock Pytlik <bpytlik@sun.com>
parents: 1286
diff changeset
  2022
                expected_string = _("%(name)s had a bad value of '%(bv)s'") % {
0f82f71cbf19 9845 Query.fromstr needs more error handling
Brock Pytlik <bpytlik@sun.com>
parents: 1286
diff changeset
  2023
                    "name": "start_point",
0f82f71cbf19 9845 Query.fromstr needs more error handling
Brock Pytlik <bpytlik@sun.com>
parents: 1286
diff changeset
  2024
                    "bv": "NOne"
0f82f71cbf19 9845 Query.fromstr needs more error handling
Brock Pytlik <bpytlik@sun.com>
parents: 1286
diff changeset
  2025
                }
0f82f71cbf19 9845 Query.fromstr needs more error handling
Brock Pytlik <bpytlik@sun.com>
parents: 1286
diff changeset
  2026
                expected_code = 404
0f82f71cbf19 9845 Query.fromstr needs more error handling
Brock Pytlik <bpytlik@sun.com>
parents: 1286
diff changeset
  2027
                q_str = "False_2_None_NOne_foo"
0f82f71cbf19 9845 Query.fromstr needs more error handling
Brock Pytlik <bpytlik@sun.com>
parents: 1286
diff changeset
  2028
                self.validateAssertRaises(urllib2.HTTPError,
0f82f71cbf19 9845 Query.fromstr needs more error handling
Brock Pytlik <bpytlik@sun.com>
parents: 1286
diff changeset
  2029
                    lambda x: self._check_err(x, expected_string,
0f82f71cbf19 9845 Query.fromstr needs more error handling
Brock Pytlik <bpytlik@sun.com>
parents: 1286
diff changeset
  2030
                        expected_code),
0f82f71cbf19 9845 Query.fromstr needs more error handling
Brock Pytlik <bpytlik@sun.com>
parents: 1286
diff changeset
  2031
                    urllib2.urlopen, durl + "/search/1/" + q_str)
0f82f71cbf19 9845 Query.fromstr needs more error handling
Brock Pytlik <bpytlik@sun.com>
parents: 1286
diff changeset
  2032
0f82f71cbf19 9845 Query.fromstr needs more error handling
Brock Pytlik <bpytlik@sun.com>
parents: 1286
diff changeset
  2033
        def test_bug_9845_07(self):
0f82f71cbf19 9845 Query.fromstr needs more error handling
Brock Pytlik <bpytlik@sun.com>
parents: 1286
diff changeset
  2034
                """Test that a corrupt case_sensitive value doesn't break the "
0f82f71cbf19 9845 Query.fromstr needs more error handling
Brock Pytlik <bpytlik@sun.com>
parents: 1286
diff changeset
  2035
                server."""
0f82f71cbf19 9845 Query.fromstr needs more error handling
Brock Pytlik <bpytlik@sun.com>
parents: 1286
diff changeset
  2036
                durl = self.dc.get_depot_url()
0f82f71cbf19 9845 Query.fromstr needs more error handling
Brock Pytlik <bpytlik@sun.com>
parents: 1286
diff changeset
  2037
                expected_string = _("%(name)s had a bad value of '%(bv)s'") % {
0f82f71cbf19 9845 Query.fromstr needs more error handling
Brock Pytlik <bpytlik@sun.com>
parents: 1286
diff changeset
  2038
                    "name": "case_sensitive",
0f82f71cbf19 9845 Query.fromstr needs more error handling
Brock Pytlik <bpytlik@sun.com>
parents: 1286
diff changeset
  2039
                    "bv": ""
0f82f71cbf19 9845 Query.fromstr needs more error handling
Brock Pytlik <bpytlik@sun.com>
parents: 1286
diff changeset
  2040
                }
0f82f71cbf19 9845 Query.fromstr needs more error handling
Brock Pytlik <bpytlik@sun.com>
parents: 1286
diff changeset
  2041
                expected_code = 404
0f82f71cbf19 9845 Query.fromstr needs more error handling
Brock Pytlik <bpytlik@sun.com>
parents: 1286
diff changeset
  2042
                q_str = "_2_None_None_foo"
0f82f71cbf19 9845 Query.fromstr needs more error handling
Brock Pytlik <bpytlik@sun.com>
parents: 1286
diff changeset
  2043
                self.validateAssertRaises(urllib2.HTTPError,
0f82f71cbf19 9845 Query.fromstr needs more error handling
Brock Pytlik <bpytlik@sun.com>
parents: 1286
diff changeset
  2044
                    lambda x: self._check_err(x, expected_string,
0f82f71cbf19 9845 Query.fromstr needs more error handling
Brock Pytlik <bpytlik@sun.com>
parents: 1286
diff changeset
  2045
                        expected_code),
0f82f71cbf19 9845 Query.fromstr needs more error handling
Brock Pytlik <bpytlik@sun.com>
parents: 1286
diff changeset
  2046
                    urllib2.urlopen, durl + "/search/1/" + q_str)
0f82f71cbf19 9845 Query.fromstr needs more error handling
Brock Pytlik <bpytlik@sun.com>
parents: 1286
diff changeset
  2047
0f82f71cbf19 9845 Query.fromstr needs more error handling
Brock Pytlik <bpytlik@sun.com>
parents: 1286
diff changeset
  2048
        def test_bug_9845_08(self):
0f82f71cbf19 9845 Query.fromstr needs more error handling
Brock Pytlik <bpytlik@sun.com>
parents: 1286
diff changeset
  2049
                """Test that a missing return_type value doesn't break the "
0f82f71cbf19 9845 Query.fromstr needs more error handling
Brock Pytlik <bpytlik@sun.com>
parents: 1286
diff changeset
  2050
                server."""
0f82f71cbf19 9845 Query.fromstr needs more error handling
Brock Pytlik <bpytlik@sun.com>
parents: 1286
diff changeset
  2051
                durl = self.dc.get_depot_url()
0f82f71cbf19 9845 Query.fromstr needs more error handling
Brock Pytlik <bpytlik@sun.com>
parents: 1286
diff changeset
  2052
                expected_string = _("%(name)s had a bad value of '%(bv)s'") % {
0f82f71cbf19 9845 Query.fromstr needs more error handling
Brock Pytlik <bpytlik@sun.com>
parents: 1286
diff changeset
  2053
                    "name": "return_type",
0f82f71cbf19 9845 Query.fromstr needs more error handling
Brock Pytlik <bpytlik@sun.com>
parents: 1286
diff changeset
  2054
                    "bv": ""
0f82f71cbf19 9845 Query.fromstr needs more error handling
Brock Pytlik <bpytlik@sun.com>
parents: 1286
diff changeset
  2055
                }
0f82f71cbf19 9845 Query.fromstr needs more error handling
Brock Pytlik <bpytlik@sun.com>
parents: 1286
diff changeset
  2056
                expected_code = 404
0f82f71cbf19 9845 Query.fromstr needs more error handling
Brock Pytlik <bpytlik@sun.com>
parents: 1286
diff changeset
  2057
                q_str = "False__None_None_foo"
0f82f71cbf19 9845 Query.fromstr needs more error handling
Brock Pytlik <bpytlik@sun.com>
parents: 1286
diff changeset
  2058
                self.validateAssertRaises(urllib2.HTTPError,
0f82f71cbf19 9845 Query.fromstr needs more error handling
Brock Pytlik <bpytlik@sun.com>
parents: 1286
diff changeset
  2059
                    lambda x: self._check_err(x, expected_string,
0f82f71cbf19 9845 Query.fromstr needs more error handling
Brock Pytlik <bpytlik@sun.com>
parents: 1286
diff changeset
  2060
                        expected_code),
0f82f71cbf19 9845 Query.fromstr needs more error handling
Brock Pytlik <bpytlik@sun.com>
parents: 1286
diff changeset
  2061
                    urllib2.urlopen, durl + "/search/1/" + q_str)
0f82f71cbf19 9845 Query.fromstr needs more error handling
Brock Pytlik <bpytlik@sun.com>
parents: 1286
diff changeset
  2062
0f82f71cbf19 9845 Query.fromstr needs more error handling
Brock Pytlik <bpytlik@sun.com>
parents: 1286
diff changeset
  2063
        def test_bug_9845_09(self):
0f82f71cbf19 9845 Query.fromstr needs more error handling
Brock Pytlik <bpytlik@sun.com>
parents: 1286
diff changeset
  2064
                """Test that a missing num_to_return value doesn't break the "
0f82f71cbf19 9845 Query.fromstr needs more error handling
Brock Pytlik <bpytlik@sun.com>
parents: 1286
diff changeset
  2065
                server."""
0f82f71cbf19 9845 Query.fromstr needs more error handling
Brock Pytlik <bpytlik@sun.com>
parents: 1286
diff changeset
  2066
                durl = self.dc.get_depot_url()
0f82f71cbf19 9845 Query.fromstr needs more error handling
Brock Pytlik <bpytlik@sun.com>
parents: 1286
diff changeset
  2067
                expected_string = _("%(name)s had a bad value of '%(bv)s'") % {
0f82f71cbf19 9845 Query.fromstr needs more error handling
Brock Pytlik <bpytlik@sun.com>
parents: 1286
diff changeset
  2068
                    "name": "num_to_return",
0f82f71cbf19 9845 Query.fromstr needs more error handling
Brock Pytlik <bpytlik@sun.com>
parents: 1286
diff changeset
  2069
                    "bv": ""
0f82f71cbf19 9845 Query.fromstr needs more error handling
Brock Pytlik <bpytlik@sun.com>
parents: 1286
diff changeset
  2070
                }
0f82f71cbf19 9845 Query.fromstr needs more error handling
Brock Pytlik <bpytlik@sun.com>
parents: 1286
diff changeset
  2071
                expected_code = 404
0f82f71cbf19 9845 Query.fromstr needs more error handling
Brock Pytlik <bpytlik@sun.com>
parents: 1286
diff changeset
  2072
                q_str = "False_2__None_foo"
0f82f71cbf19 9845 Query.fromstr needs more error handling
Brock Pytlik <bpytlik@sun.com>
parents: 1286
diff changeset
  2073
                self.validateAssertRaises(urllib2.HTTPError,
0f82f71cbf19 9845 Query.fromstr needs more error handling
Brock Pytlik <bpytlik@sun.com>
parents: 1286
diff changeset
  2074
                    lambda x: self._check_err(x, expected_string,
0f82f71cbf19 9845 Query.fromstr needs more error handling
Brock Pytlik <bpytlik@sun.com>
parents: 1286
diff changeset
  2075
                        expected_code),
0f82f71cbf19 9845 Query.fromstr needs more error handling
Brock Pytlik <bpytlik@sun.com>
parents: 1286
diff changeset
  2076
                    urllib2.urlopen, durl + "/search/1/" + q_str)
0f82f71cbf19 9845 Query.fromstr needs more error handling
Brock Pytlik <bpytlik@sun.com>
parents: 1286
diff changeset
  2077
0f82f71cbf19 9845 Query.fromstr needs more error handling
Brock Pytlik <bpytlik@sun.com>
parents: 1286
diff changeset
  2078
        def test_bug_9845_10(self):
0f82f71cbf19 9845 Query.fromstr needs more error handling
Brock Pytlik <bpytlik@sun.com>
parents: 1286
diff changeset
  2079
                """Test that a missing start_point value doesn't break the "
0f82f71cbf19 9845 Query.fromstr needs more error handling
Brock Pytlik <bpytlik@sun.com>
parents: 1286
diff changeset
  2080
                server."""
0f82f71cbf19 9845 Query.fromstr needs more error handling
Brock Pytlik <bpytlik@sun.com>
parents: 1286
diff changeset
  2081
                durl = self.dc.get_depot_url()
0f82f71cbf19 9845 Query.fromstr needs more error handling
Brock Pytlik <bpytlik@sun.com>
parents: 1286
diff changeset
  2082
                expected_string = _("%(name)s had a bad value of '%(bv)s'") % {
0f82f71cbf19 9845 Query.fromstr needs more error handling
Brock Pytlik <bpytlik@sun.com>
parents: 1286
diff changeset
  2083
                    "name": "start_point",
0f82f71cbf19 9845 Query.fromstr needs more error handling
Brock Pytlik <bpytlik@sun.com>
parents: 1286
diff changeset
  2084
                    "bv": ""
0f82f71cbf19 9845 Query.fromstr needs more error handling
Brock Pytlik <bpytlik@sun.com>
parents: 1286
diff changeset
  2085
                }
0f82f71cbf19 9845 Query.fromstr needs more error handling
Brock Pytlik <bpytlik@sun.com>
parents: 1286
diff changeset
  2086
                expected_code = 404
0f82f71cbf19 9845 Query.fromstr needs more error handling
Brock Pytlik <bpytlik@sun.com>
parents: 1286
diff changeset
  2087
                q_str = "False_2_None__foo"
0f82f71cbf19 9845 Query.fromstr needs more error handling
Brock Pytlik <bpytlik@sun.com>
parents: 1286
diff changeset
  2088
                self.validateAssertRaises(urllib2.HTTPError,
0f82f71cbf19 9845 Query.fromstr needs more error handling
Brock Pytlik <bpytlik@sun.com>
parents: 1286
diff changeset
  2089
                    lambda x: self._check_err(x, expected_string,
0f82f71cbf19 9845 Query.fromstr needs more error handling
Brock Pytlik <bpytlik@sun.com>
parents: 1286
diff changeset
  2090
                        expected_code),
0f82f71cbf19 9845 Query.fromstr needs more error handling
Brock Pytlik <bpytlik@sun.com>
parents: 1286
diff changeset
  2091
                    urllib2.urlopen, durl + "/search/1/" + q_str)
0f82f71cbf19 9845 Query.fromstr needs more error handling
Brock Pytlik <bpytlik@sun.com>
parents: 1286
diff changeset
  2092
0f82f71cbf19 9845 Query.fromstr needs more error handling
Brock Pytlik <bpytlik@sun.com>
parents: 1286
diff changeset
  2093
        def test_bug_9845_11(self):
0f82f71cbf19 9845 Query.fromstr needs more error handling
Brock Pytlik <bpytlik@sun.com>
parents: 1286
diff changeset
  2094
                """Test that missing query text doesn't break the server."""
0f82f71cbf19 9845 Query.fromstr needs more error handling
Brock Pytlik <bpytlik@sun.com>
parents: 1286
diff changeset
  2095
                durl = self.dc.get_depot_url()
0f82f71cbf19 9845 Query.fromstr needs more error handling
Brock Pytlik <bpytlik@sun.com>
parents: 1286
diff changeset
  2096
                expected_string = _("Could not parse query.")
0f82f71cbf19 9845 Query.fromstr needs more error handling
Brock Pytlik <bpytlik@sun.com>
parents: 1286
diff changeset
  2097
                expected_code = 400
0f82f71cbf19 9845 Query.fromstr needs more error handling
Brock Pytlik <bpytlik@sun.com>
parents: 1286
diff changeset
  2098
                q_str = "False_2_None_None_"
0f82f71cbf19 9845 Query.fromstr needs more error handling
Brock Pytlik <bpytlik@sun.com>
parents: 1286
diff changeset
  2099
                self.validateAssertRaises(urllib2.HTTPError,
0f82f71cbf19 9845 Query.fromstr needs more error handling
Brock Pytlik <bpytlik@sun.com>
parents: 1286
diff changeset
  2100
                    lambda x: self._check_err(x, expected_string,
0f82f71cbf19 9845 Query.fromstr needs more error handling
Brock Pytlik <bpytlik@sun.com>
parents: 1286
diff changeset
  2101
                        expected_code),
0f82f71cbf19 9845 Query.fromstr needs more error handling
Brock Pytlik <bpytlik@sun.com>
parents: 1286
diff changeset
  2102
                    urllib2.urlopen, durl + "/search/1/" + q_str)
0f82f71cbf19 9845 Query.fromstr needs more error handling
Brock Pytlik <bpytlik@sun.com>
parents: 1286
diff changeset
  2103
0f82f71cbf19 9845 Query.fromstr needs more error handling
Brock Pytlik <bpytlik@sun.com>
parents: 1286
diff changeset
  2104
1431
62b6033670e4 10416 server catalog v1 support desired
Shawn Walker <srw@sun.com>
parents: 1423
diff changeset
  2105
class TestApiSearchBasicsRestartingDepot(TestApiSearchBasics):
1127
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
  2106
        def setUp(self):
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
  2107
                self.debug_features = ["headers"]
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
  2108
                TestApiSearchBasics.setUp(self)
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
  2109
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
  2110
        def test_local_image_update(self):
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
  2111
                """Test that the index gets updated by image-update and
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
  2112
                that rebuilding the index works after updating the
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
  2113
                image. Specifically, this tests that rebuilding indexes with
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
  2114
                gaps in them works correctly."""
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
  2115
                durl = self.dc.get_depot_url()
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
  2116
                self.pkgsend_bulk(durl, self.example_pkg10)
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
  2117
                self.image_create(durl)
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
  2118
                progresstracker = progress.NullProgressTracker()
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
  2119
                api_obj = api.ImageInterface(self.get_img_path(), API_VERSION,
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
  2120
                    progresstracker, lambda x: False, PKG_CLIENT_NAME)
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
  2121
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
  2122
                self._do_install(api_obj, ["example_pkg"])
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
  2123
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
  2124
                self.pkgsend_bulk(durl, self.example_pkg11)
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
  2125
                api_obj.refresh(immediate=True)
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
  2126
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
  2127
                self._do_image_update(api_obj)
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
  2128
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
  2129
                self._run_local_tests_example11_installed(api_obj)
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
  2130
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
  2131
                api_obj.rebuild_search_index()
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
  2132
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
  2133
                self._run_local_tests_example11_installed(api_obj)
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
  2134
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
  2135
        def test_bug_4048_1(self):
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
  2136
                """Checks whether the server deals with partial indexing."""
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
  2137
                durl = self.dc.get_depot_url()
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
  2138
                depotpath = self.dc.get_repodir()
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
  2139
                tmp_dir = os.path.join(depotpath, "index", "TMP")
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
  2140
                os.mkdir(tmp_dir)
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
  2141
                self.pkgsend_bulk(durl, self.example_pkg10)
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
  2142
                self.image_create(durl)
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
  2143
                progresstracker = progress.NullProgressTracker()
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
  2144
                api_obj = api.ImageInterface(self.get_img_path(), API_VERSION,
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
  2145
                    progresstracker, lambda x: False, PKG_CLIENT_NAME)
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
  2146
                self._run_remote_empty_tests(api_obj)
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
  2147
                os.rmdir(tmp_dir)
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
  2148
                offset = 2
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
  2149
                depot_logfile = os.path.join(self.get_test_prefix(),
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
  2150
                    self.id(), "depot_logfile%d" % offset)
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
  2151
                tmp_dc = self.start_depot(12000 + offset, depotpath,
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
  2152
                    depot_logfile, refresh_index=True)
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
  2153
                time.sleep(1)
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
  2154
                # This should do something other than sleep for 1 sec
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
  2155
                self._run_remote_tests(api_obj)
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
  2156
                tmp_dc.kill()
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
  2157
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
  2158
        def test_bug_4048_2(self):
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
  2159
                """Checks whether the server deals with partial indexing."""
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
  2160
                durl = self.dc.get_depot_url()
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
  2161
                depotpath = self.dc.get_repodir()
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
  2162
                tmp_dir = os.path.join(depotpath, "index", "TMP")
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
  2163
                os.mkdir(tmp_dir)
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
  2164
                self.pkgsend_bulk(durl, self.space_pkg10)
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
  2165
                self.image_create(durl)
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
  2166
                progresstracker = progress.NullProgressTracker()
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
  2167
                api_obj = api.ImageInterface(self.get_img_path(), API_VERSION,
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
  2168
                    progresstracker, lambda x: False, PKG_CLIENT_NAME)
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
  2169
                self._run_remote_empty_tests(api_obj)
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
  2170
                os.rmdir(tmp_dir)
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
  2171
                self.pkgsend_bulk(durl, self.example_pkg10)
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
  2172
                time.sleep(1)
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
  2173
                self._run_remote_tests(api_obj)
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
  2174
                self._search_op(api_obj, True, "unique_dir",
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
  2175
                    self.res_space_unique)
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
  2176
                self._search_op(api_obj, True, "with*",
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
  2177
                    self.res_space_with_star)
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
  2178
1009
01f531556b53 7358 Depot throws a stack trace when started with an old index (should rebuild)
Brock Pytlik <bpytlik@sun.com>
parents: 996
diff changeset
  2179
        def __corrupt_depot(self, ind_dir):
01f531556b53 7358 Depot throws a stack trace when started with an old index (should rebuild)
Brock Pytlik <bpytlik@sun.com>
parents: 996
diff changeset
  2180
                self.dc.stop()
01f531556b53 7358 Depot throws a stack trace when started with an old index (should rebuild)
Brock Pytlik <bpytlik@sun.com>
parents: 996
diff changeset
  2181
                if os.path.exists(os.path.join(ind_dir, ss.MAIN_FILE)):
01f531556b53 7358 Depot throws a stack trace when started with an old index (should rebuild)
Brock Pytlik <bpytlik@sun.com>
parents: 996
diff changeset
  2182
                        shutil.move(os.path.join(ind_dir, ss.MAIN_FILE),
01f531556b53 7358 Depot throws a stack trace when started with an old index (should rebuild)
Brock Pytlik <bpytlik@sun.com>
parents: 996
diff changeset
  2183
                            os.path.join(ind_dir, "main_dict.ascii.v1"))
01f531556b53 7358 Depot throws a stack trace when started with an old index (should rebuild)
Brock Pytlik <bpytlik@sun.com>
parents: 996
diff changeset
  2184
                self.dc.start()
01f531556b53 7358 Depot throws a stack trace when started with an old index (should rebuild)
Brock Pytlik <bpytlik@sun.com>
parents: 996
diff changeset
  2185
01f531556b53 7358 Depot throws a stack trace when started with an old index (should rebuild)
Brock Pytlik <bpytlik@sun.com>
parents: 996
diff changeset
  2186
        def __wait_for_indexing(self, d):
01f531556b53 7358 Depot throws a stack trace when started with an old index (should rebuild)
Brock Pytlik <bpytlik@sun.com>
parents: 996
diff changeset
  2187
                init_time = time.time()
01f531556b53 7358 Depot throws a stack trace when started with an old index (should rebuild)
Brock Pytlik <bpytlik@sun.com>
parents: 996
diff changeset
  2188
                there = True
01f531556b53 7358 Depot throws a stack trace when started with an old index (should rebuild)
Brock Pytlik <bpytlik@sun.com>
parents: 996
diff changeset
  2189
                while there and ((time.time() - init_time) < 10):
01f531556b53 7358 Depot throws a stack trace when started with an old index (should rebuild)
Brock Pytlik <bpytlik@sun.com>
parents: 996
diff changeset
  2190
                        there = os.path.exists(d)
01f531556b53 7358 Depot throws a stack trace when started with an old index (should rebuild)
Brock Pytlik <bpytlik@sun.com>
parents: 996
diff changeset
  2191
                self.assert_(not there)
01f531556b53 7358 Depot throws a stack trace when started with an old index (should rebuild)
Brock Pytlik <bpytlik@sun.com>
parents: 996
diff changeset
  2192
                time.sleep(1)
01f531556b53 7358 Depot throws a stack trace when started with an old index (should rebuild)
Brock Pytlik <bpytlik@sun.com>
parents: 996
diff changeset
  2193
01f531556b53 7358 Depot throws a stack trace when started with an old index (should rebuild)
Brock Pytlik <bpytlik@sun.com>
parents: 996
diff changeset
  2194
        def test_bug_7358_1(self):
01f531556b53 7358 Depot throws a stack trace when started with an old index (should rebuild)
Brock Pytlik <bpytlik@sun.com>
parents: 996
diff changeset
  2195
                """Move files so that an inconsistent index is created and
01f531556b53 7358 Depot throws a stack trace when started with an old index (should rebuild)
Brock Pytlik <bpytlik@sun.com>
parents: 996
diff changeset
  2196
                check that the server rebuilds the index when possible, and
01f531556b53 7358 Depot throws a stack trace when started with an old index (should rebuild)
Brock Pytlik <bpytlik@sun.com>
parents: 996
diff changeset
  2197
                doesn't stack trace when it can't write to the directory."""
01f531556b53 7358 Depot throws a stack trace when started with an old index (should rebuild)
Brock Pytlik <bpytlik@sun.com>
parents: 996
diff changeset
  2198
01f531556b53 7358 Depot throws a stack trace when started with an old index (should rebuild)
Brock Pytlik <bpytlik@sun.com>
parents: 996
diff changeset
  2199
                durl = self.dc.get_depot_url()
01f531556b53 7358 Depot throws a stack trace when started with an old index (should rebuild)
Brock Pytlik <bpytlik@sun.com>
parents: 996
diff changeset
  2200
                depotpath = self.dc.get_repodir()
01f531556b53 7358 Depot throws a stack trace when started with an old index (should rebuild)
Brock Pytlik <bpytlik@sun.com>
parents: 996
diff changeset
  2201
                ind_dir = os.path.join(depotpath, "index")
01f531556b53 7358 Depot throws a stack trace when started with an old index (should rebuild)
Brock Pytlik <bpytlik@sun.com>
parents: 996
diff changeset
  2202
                self.image_create(durl)
01f531556b53 7358 Depot throws a stack trace when started with an old index (should rebuild)
Brock Pytlik <bpytlik@sun.com>
parents: 996
diff changeset
  2203
                progresstracker = progress.NullProgressTracker()
01f531556b53 7358 Depot throws a stack trace when started with an old index (should rebuild)
Brock Pytlik <bpytlik@sun.com>
parents: 996
diff changeset
  2204
                api_obj = api.ImageInterface(self.get_img_path(), API_VERSION,
01f531556b53 7358 Depot throws a stack trace when started with an old index (should rebuild)
Brock Pytlik <bpytlik@sun.com>
parents: 996
diff changeset
  2205
                    progresstracker, lambda x: False, PKG_CLIENT_NAME)
01f531556b53 7358 Depot throws a stack trace when started with an old index (should rebuild)
Brock Pytlik <bpytlik@sun.com>
parents: 996
diff changeset
  2206
                # Check when depot is empty.
01f531556b53 7358 Depot throws a stack trace when started with an old index (should rebuild)
Brock Pytlik <bpytlik@sun.com>
parents: 996
diff changeset
  2207
                self.__corrupt_depot(ind_dir)
01f531556b53 7358 Depot throws a stack trace when started with an old index (should rebuild)
Brock Pytlik <bpytlik@sun.com>
parents: 996
diff changeset
  2208
                self.__wait_for_indexing(os.path.join(ind_dir, "TMP"))
01f531556b53 7358 Depot throws a stack trace when started with an old index (should rebuild)
Brock Pytlik <bpytlik@sun.com>
parents: 996
diff changeset
  2209
                # Since the depot is empty, should return no results but
01f531556b53 7358 Depot throws a stack trace when started with an old index (should rebuild)
Brock Pytlik <bpytlik@sun.com>
parents: 996
diff changeset
  2210
                # not error.
01f531556b53 7358 Depot throws a stack trace when started with an old index (should rebuild)
Brock Pytlik <bpytlik@sun.com>
parents: 996
diff changeset
  2211
                self._search_op(api_obj, True, 'e*', set())
01f531556b53 7358 Depot throws a stack trace when started with an old index (should rebuild)
Brock Pytlik <bpytlik@sun.com>
parents: 996
diff changeset
  2212
01f531556b53 7358 Depot throws a stack trace when started with an old index (should rebuild)
Brock Pytlik <bpytlik@sun.com>
parents: 996
diff changeset
  2213
                self.pkgsend_bulk(durl, self.example_pkg10)
01f531556b53 7358 Depot throws a stack trace when started with an old index (should rebuild)
Brock Pytlik <bpytlik@sun.com>
parents: 996
diff changeset
  2214
                self.__wait_for_indexing(os.path.join(ind_dir, "TMP"))
01f531556b53 7358 Depot throws a stack trace when started with an old index (should rebuild)
Brock Pytlik <bpytlik@sun.com>
parents: 996
diff changeset
  2215
01f531556b53 7358 Depot throws a stack trace when started with an old index (should rebuild)
Brock Pytlik <bpytlik@sun.com>
parents: 996
diff changeset
  2216
                # Check when depot contains a package.
01f531556b53 7358 Depot throws a stack trace when started with an old index (should rebuild)
Brock Pytlik <bpytlik@sun.com>
parents: 996
diff changeset
  2217
                self.__corrupt_depot(ind_dir)
01f531556b53 7358 Depot throws a stack trace when started with an old index (should rebuild)
Brock Pytlik <bpytlik@sun.com>
parents: 996
diff changeset
  2218
                self.__wait_for_indexing(os.path.join(ind_dir, "TMP"))
01f531556b53 7358 Depot throws a stack trace when started with an old index (should rebuild)
Brock Pytlik <bpytlik@sun.com>
parents: 996
diff changeset
  2219
                self._run_remote_tests(api_obj)
01f531556b53 7358 Depot throws a stack trace when started with an old index (should rebuild)
Brock Pytlik <bpytlik@sun.com>
parents: 996
diff changeset
  2220
01f531556b53 7358 Depot throws a stack trace when started with an old index (should rebuild)
Brock Pytlik <bpytlik@sun.com>
parents: 996
diff changeset
  2221
        def test_bug_7358_2(self):
01f531556b53 7358 Depot throws a stack trace when started with an old index (should rebuild)
Brock Pytlik <bpytlik@sun.com>
parents: 996
diff changeset
  2222
                """Does same check as 7358_1 except it checks for interactions
01f531556b53 7358 Depot throws a stack trace when started with an old index (should rebuild)
Brock Pytlik <bpytlik@sun.com>
parents: 996
diff changeset
  2223
                with writable root."""
01f531556b53 7358 Depot throws a stack trace when started with an old index (should rebuild)
Brock Pytlik <bpytlik@sun.com>
parents: 996
diff changeset
  2224
01f531556b53 7358 Depot throws a stack trace when started with an old index (should rebuild)
Brock Pytlik <bpytlik@sun.com>
parents: 996
diff changeset
  2225
                durl = self.dc.get_depot_url()
01f531556b53 7358 Depot throws a stack trace when started with an old index (should rebuild)
Brock Pytlik <bpytlik@sun.com>
parents: 996
diff changeset
  2226
                depotpath = self.dc.get_repodir()
01f531556b53 7358 Depot throws a stack trace when started with an old index (should rebuild)
Brock Pytlik <bpytlik@sun.com>
parents: 996
diff changeset
  2227
                ind_dir = os.path.join(depotpath, "index")
01f531556b53 7358 Depot throws a stack trace when started with an old index (should rebuild)
Brock Pytlik <bpytlik@sun.com>
parents: 996
diff changeset
  2228
                shutil.rmtree(ind_dir)
01f531556b53 7358 Depot throws a stack trace when started with an old index (should rebuild)
Brock Pytlik <bpytlik@sun.com>
parents: 996
diff changeset
  2229
                writable_root = os.path.join(self.get_test_prefix(),
01f531556b53 7358 Depot throws a stack trace when started with an old index (should rebuild)
Brock Pytlik <bpytlik@sun.com>
parents: 996
diff changeset
  2230
                    "writ_root")
01f531556b53 7358 Depot throws a stack trace when started with an old index (should rebuild)
Brock Pytlik <bpytlik@sun.com>
parents: 996
diff changeset
  2231
                writ_dir = os.path.join(writable_root, "index")
01f531556b53 7358 Depot throws a stack trace when started with an old index (should rebuild)
Brock Pytlik <bpytlik@sun.com>
parents: 996
diff changeset
  2232
                self.dc.set_writable_root(writable_root)
1431
62b6033670e4 10416 server catalog v1 support desired
Shawn Walker <srw@sun.com>
parents: 1423
diff changeset
  2233
1009
01f531556b53 7358 Depot throws a stack trace when started with an old index (should rebuild)
Brock Pytlik <bpytlik@sun.com>
parents: 996
diff changeset
  2234
                self.image_create(durl)
01f531556b53 7358 Depot throws a stack trace when started with an old index (should rebuild)
Brock Pytlik <bpytlik@sun.com>
parents: 996
diff changeset
  2235
                progresstracker = progress.NullProgressTracker()
01f531556b53 7358 Depot throws a stack trace when started with an old index (should rebuild)
Brock Pytlik <bpytlik@sun.com>
parents: 996
diff changeset
  2236
                api_obj = api.ImageInterface(self.get_img_path(), API_VERSION,
01f531556b53 7358 Depot throws a stack trace when started with an old index (should rebuild)
Brock Pytlik <bpytlik@sun.com>
parents: 996
diff changeset
  2237
                    progresstracker, lambda x: False, PKG_CLIENT_NAME)
01f531556b53 7358 Depot throws a stack trace when started with an old index (should rebuild)
Brock Pytlik <bpytlik@sun.com>
parents: 996
diff changeset
  2238
01f531556b53 7358 Depot throws a stack trace when started with an old index (should rebuild)
Brock Pytlik <bpytlik@sun.com>
parents: 996
diff changeset
  2239
                # Check when depot is empty.
01f531556b53 7358 Depot throws a stack trace when started with an old index (should rebuild)
Brock Pytlik <bpytlik@sun.com>
parents: 996
diff changeset
  2240
                self.__corrupt_depot(writ_dir)
01f531556b53 7358 Depot throws a stack trace when started with an old index (should rebuild)
Brock Pytlik <bpytlik@sun.com>
parents: 996
diff changeset
  2241
                # Since the depot is empty, should return no results but
01f531556b53 7358 Depot throws a stack trace when started with an old index (should rebuild)
Brock Pytlik <bpytlik@sun.com>
parents: 996
diff changeset
  2242
                # not error.
01f531556b53 7358 Depot throws a stack trace when started with an old index (should rebuild)
Brock Pytlik <bpytlik@sun.com>
parents: 996
diff changeset
  2243
                self.assert_(not os.path.isdir(ind_dir))
01f531556b53 7358 Depot throws a stack trace when started with an old index (should rebuild)
Brock Pytlik <bpytlik@sun.com>
parents: 996
diff changeset
  2244
                self.__wait_for_indexing(os.path.join(writ_dir, "TMP"))
01f531556b53 7358 Depot throws a stack trace when started with an old index (should rebuild)
Brock Pytlik <bpytlik@sun.com>
parents: 996
diff changeset
  2245
                self._search_op(api_obj, True, 'e*', set())
01f531556b53 7358 Depot throws a stack trace when started with an old index (should rebuild)
Brock Pytlik <bpytlik@sun.com>
parents: 996
diff changeset
  2246
01f531556b53 7358 Depot throws a stack trace when started with an old index (should rebuild)
Brock Pytlik <bpytlik@sun.com>
parents: 996
diff changeset
  2247
                self.pkgsend_bulk(durl, self.example_pkg10)
01f531556b53 7358 Depot throws a stack trace when started with an old index (should rebuild)
Brock Pytlik <bpytlik@sun.com>
parents: 996
diff changeset
  2248
                self.__wait_for_indexing(os.path.join(writ_dir, "TMP"))
1431
62b6033670e4 10416 server catalog v1 support desired
Shawn Walker <srw@sun.com>
parents: 1423
diff changeset
  2249
1009
01f531556b53 7358 Depot throws a stack trace when started with an old index (should rebuild)
Brock Pytlik <bpytlik@sun.com>
parents: 996
diff changeset
  2250
                # Check when depot contains a package.
01f531556b53 7358 Depot throws a stack trace when started with an old index (should rebuild)
Brock Pytlik <bpytlik@sun.com>
parents: 996
diff changeset
  2251
                self.__corrupt_depot(writ_dir)
01f531556b53 7358 Depot throws a stack trace when started with an old index (should rebuild)
Brock Pytlik <bpytlik@sun.com>
parents: 996
diff changeset
  2252
                self.__wait_for_indexing(os.path.join(writ_dir, "TMP"))
01f531556b53 7358 Depot throws a stack trace when started with an old index (should rebuild)
Brock Pytlik <bpytlik@sun.com>
parents: 996
diff changeset
  2253
                self.assert_(not os.path.isdir(ind_dir))
01f531556b53 7358 Depot throws a stack trace when started with an old index (should rebuild)
Brock Pytlik <bpytlik@sun.com>
parents: 996
diff changeset
  2254
                self._run_remote_tests(api_obj)
1431
62b6033670e4 10416 server catalog v1 support desired
Shawn Walker <srw@sun.com>
parents: 1423
diff changeset
  2255
1081
0cc3e524ea7f 8318 search v1 not sending uuid
Brock Pytlik <bpytlik@sun.com>
parents: 1054
diff changeset
  2256
        def test_bug_8318(self):
0cc3e524ea7f 8318 search v1 not sending uuid
Brock Pytlik <bpytlik@sun.com>
parents: 1054
diff changeset
  2257
                durl = self.dc.get_depot_url()
0cc3e524ea7f 8318 search v1 not sending uuid
Brock Pytlik <bpytlik@sun.com>
parents: 1054
diff changeset
  2258
                self.pkgsend_bulk(durl, self.example_pkg10)
0cc3e524ea7f 8318 search v1 not sending uuid
Brock Pytlik <bpytlik@sun.com>
parents: 1054
diff changeset
  2259
                self.image_create(durl)
0cc3e524ea7f 8318 search v1 not sending uuid
Brock Pytlik <bpytlik@sun.com>
parents: 1054
diff changeset
  2260
                progresstracker = progress.NullProgressTracker()
0cc3e524ea7f 8318 search v1 not sending uuid
Brock Pytlik <bpytlik@sun.com>
parents: 1054
diff changeset
  2261
                api_obj = api.ImageInterface(self.get_img_path(), API_VERSION,
0cc3e524ea7f 8318 search v1 not sending uuid
Brock Pytlik <bpytlik@sun.com>
parents: 1054
diff changeset
  2262
                    progresstracker, lambda x: True, PKG_CLIENT_NAME)
0cc3e524ea7f 8318 search v1 not sending uuid
Brock Pytlik <bpytlik@sun.com>
parents: 1054
diff changeset
  2263
                uuids = []
0cc3e524ea7f 8318 search v1 not sending uuid
Brock Pytlik <bpytlik@sun.com>
parents: 1054
diff changeset
  2264
                for p in api_obj.img.gen_publishers():
0cc3e524ea7f 8318 search v1 not sending uuid
Brock Pytlik <bpytlik@sun.com>
parents: 1054
diff changeset
  2265
                        uuids.append(p.client_uuid)
1431
62b6033670e4 10416 server catalog v1 support desired
Shawn Walker <srw@sun.com>
parents: 1423
diff changeset
  2266
1081
0cc3e524ea7f 8318 search v1 not sending uuid
Brock Pytlik <bpytlik@sun.com>
parents: 1054
diff changeset
  2267
                self._search_op(api_obj, True, "example_path",
0cc3e524ea7f 8318 search v1 not sending uuid
Brock Pytlik <bpytlik@sun.com>
parents: 1054
diff changeset
  2268
                    self.res_remote_path)
0cc3e524ea7f 8318 search v1 not sending uuid
Brock Pytlik <bpytlik@sun.com>
parents: 1054
diff changeset
  2269
                self._search_op(api_obj, True, "example_path",
0cc3e524ea7f 8318 search v1 not sending uuid
Brock Pytlik <bpytlik@sun.com>
parents: 1054
diff changeset
  2270
                    self.res_remote_path, servers=[{"origin": durl}])
0cc3e524ea7f 8318 search v1 not sending uuid
Brock Pytlik <bpytlik@sun.com>
parents: 1054
diff changeset
  2271
                lfh = file(self.dc.get_logpath(), "rb")
0cc3e524ea7f 8318 search v1 not sending uuid
Brock Pytlik <bpytlik@sun.com>
parents: 1054
diff changeset
  2272
                found = 0
1431
62b6033670e4 10416 server catalog v1 support desired
Shawn Walker <srw@sun.com>
parents: 1423
diff changeset
  2273
                num_expected = 8
1081
0cc3e524ea7f 8318 search v1 not sending uuid
Brock Pytlik <bpytlik@sun.com>
parents: 1054
diff changeset
  2274
                for line in lfh:
0cc3e524ea7f 8318 search v1 not sending uuid
Brock Pytlik <bpytlik@sun.com>
parents: 1054
diff changeset
  2275
                        if "X-IPKG-UUID:" in line:
0cc3e524ea7f 8318 search v1 not sending uuid
Brock Pytlik <bpytlik@sun.com>
parents: 1054
diff changeset
  2276
                                tmp = line.split()
0cc3e524ea7f 8318 search v1 not sending uuid
Brock Pytlik <bpytlik@sun.com>
parents: 1054
diff changeset
  2277
                                s_uuid = tmp[1]
0cc3e524ea7f 8318 search v1 not sending uuid
Brock Pytlik <bpytlik@sun.com>
parents: 1054
diff changeset
  2278
                                if s_uuid not in uuids:
0cc3e524ea7f 8318 search v1 not sending uuid
Brock Pytlik <bpytlik@sun.com>
parents: 1054
diff changeset
  2279
                                        raise RuntimeError("Uuid found:%s not "
0cc3e524ea7f 8318 search v1 not sending uuid
Brock Pytlik <bpytlik@sun.com>
parents: 1054
diff changeset
  2280
                                            "found in list of possible "
0cc3e524ea7f 8318 search v1 not sending uuid
Brock Pytlik <bpytlik@sun.com>
parents: 1054
diff changeset
  2281
                                            "uuids:%s" % (s_uuid, uuids))
0cc3e524ea7f 8318 search v1 not sending uuid
Brock Pytlik <bpytlik@sun.com>
parents: 1054
diff changeset
  2282
                                found += 1
0cc3e524ea7f 8318 search v1 not sending uuid
Brock Pytlik <bpytlik@sun.com>
parents: 1054
diff changeset
  2283
                if found != num_expected:
0cc3e524ea7f 8318 search v1 not sending uuid
Brock Pytlik <bpytlik@sun.com>
parents: 1054
diff changeset
  2284
                        raise RuntimeError(("Found %s instances of a "
0cc3e524ea7f 8318 search v1 not sending uuid
Brock Pytlik <bpytlik@sun.com>
parents: 1054
diff changeset
  2285
                            "client uuid, expected to find %s.") %
0cc3e524ea7f 8318 search v1 not sending uuid
Brock Pytlik <bpytlik@sun.com>
parents: 1054
diff changeset
  2286
                            (found, num_expected))
1127
69d88cfd7f9e 7314 Refactor t_pkg_search
Brock Pytlik <bpytlik@sun.com>
parents: 1115
diff changeset
  2287
941
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
  2288
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
  2289
class TestApiSearchMulti(testutils.ManyDepotTestCase):
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
  2290
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
  2291
        example_pkg10 = """
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
  2292
            open [email protected],5.11-0
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
  2293
            close """
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
  2294
1325
0cb607b76761 10690 package installed from non-preferred pub include pub prefix in name token
Brock Pytlik <bpytlik@sun.com>
parents: 1291
diff changeset
  2295
        res_alternate_server_local = set([
1431
62b6033670e4 10416 server catalog v1 support desired
Shawn Walker <srw@sun.com>
parents: 1423
diff changeset
  2296
            ('pkg:/[email protected]', 'test2/example_pkg',
62b6033670e4 10416 server catalog v1 support desired
Shawn Walker <srw@sun.com>
parents: 1423
diff changeset
  2297
            'set name=pkg.fmri value=pkg://test2/[email protected],5.11-0:')
1325
0cb607b76761 10690 package installed from non-preferred pub include pub prefix in name token
Brock Pytlik <bpytlik@sun.com>
parents: 1291
diff changeset
  2298
        ])
0cb607b76761 10690 package installed from non-preferred pub include pub prefix in name token
Brock Pytlik <bpytlik@sun.com>
parents: 1291
diff changeset
  2299
941
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
  2300
        def setUp(self):
1431
62b6033670e4 10416 server catalog v1 support desired
Shawn Walker <srw@sun.com>
parents: 1423
diff changeset
  2301
                testutils.ManyDepotTestCase.setUp(self, ["test1", "test2",
62b6033670e4 10416 server catalog v1 support desired
Shawn Walker <srw@sun.com>
parents: 1423
diff changeset
  2302
                    "test3"], debug_features=["headers"])
1081
0cc3e524ea7f 8318 search v1 not sending uuid
Brock Pytlik <bpytlik@sun.com>
parents: 1054
diff changeset
  2303
0cc3e524ea7f 8318 search v1 not sending uuid
Brock Pytlik <bpytlik@sun.com>
parents: 1054
diff changeset
  2304
                self.durl1 = self.dcs[1].get_depot_url()
0cc3e524ea7f 8318 search v1 not sending uuid
Brock Pytlik <bpytlik@sun.com>
parents: 1054
diff changeset
  2305
                self.durl2 = self.dcs[2].get_depot_url()
0cc3e524ea7f 8318 search v1 not sending uuid
Brock Pytlik <bpytlik@sun.com>
parents: 1054
diff changeset
  2306
                self.durl3 = self.dcs[3].get_depot_url()
0cc3e524ea7f 8318 search v1 not sending uuid
Brock Pytlik <bpytlik@sun.com>
parents: 1054
diff changeset
  2307
                self.pkgsend_bulk(self.durl2, self.example_pkg10)
0cc3e524ea7f 8318 search v1 not sending uuid
Brock Pytlik <bpytlik@sun.com>
parents: 1054
diff changeset
  2308
1431
62b6033670e4 10416 server catalog v1 support desired
Shawn Walker <srw@sun.com>
parents: 1423
diff changeset
  2309
                self.image_create(self.durl1, prefix="test1")
1081
0cc3e524ea7f 8318 search v1 not sending uuid
Brock Pytlik <bpytlik@sun.com>
parents: 1054
diff changeset
  2310
                self.pkg("set-publisher -O " + self.durl2 + " test2")
941
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
  2311
1081
0cc3e524ea7f 8318 search v1 not sending uuid
Brock Pytlik <bpytlik@sun.com>
parents: 1054
diff changeset
  2312
        def _check(self, proposed_answer, correct_answer):
0cc3e524ea7f 8318 search v1 not sending uuid
Brock Pytlik <bpytlik@sun.com>
parents: 1054
diff changeset
  2313
                if correct_answer == proposed_answer:
0cc3e524ea7f 8318 search v1 not sending uuid
Brock Pytlik <bpytlik@sun.com>
parents: 1054
diff changeset
  2314
                        return True
0cc3e524ea7f 8318 search v1 not sending uuid
Brock Pytlik <bpytlik@sun.com>
parents: 1054
diff changeset
  2315
                else:
0cc3e524ea7f 8318 search v1 not sending uuid
Brock Pytlik <bpytlik@sun.com>
parents: 1054
diff changeset
  2316
                        self.debug("Proposed Answer: " + str(proposed_answer))
0cc3e524ea7f 8318 search v1 not sending uuid
Brock Pytlik <bpytlik@sun.com>
parents: 1054
diff changeset
  2317
                        self.debug("Correct Answer : " + str(correct_answer))
0cc3e524ea7f 8318 search v1 not sending uuid
Brock Pytlik <bpytlik@sun.com>
parents: 1054
diff changeset
  2318
                        if isinstance(correct_answer, set) and \
0cc3e524ea7f 8318 search v1 not sending uuid
Brock Pytlik <bpytlik@sun.com>
parents: 1054
diff changeset
  2319
                            isinstance(proposed_answer, set):
0cc3e524ea7f 8318 search v1 not sending uuid
Brock Pytlik <bpytlik@sun.com>
parents: 1054
diff changeset
  2320
                                print >> sys.stderr, "Missing: " + \
0cc3e524ea7f 8318 search v1 not sending uuid
Brock Pytlik <bpytlik@sun.com>
parents: 1054
diff changeset
  2321
                                    str(correct_answer - proposed_answer)
0cc3e524ea7f 8318 search v1 not sending uuid
Brock Pytlik <bpytlik@sun.com>
parents: 1054
diff changeset
  2322
                                print >> sys.stderr, "Extra  : " + \
0cc3e524ea7f 8318 search v1 not sending uuid
Brock Pytlik <bpytlik@sun.com>
parents: 1054
diff changeset
  2323
                                    str(proposed_answer - correct_answer)
0cc3e524ea7f 8318 search v1 not sending uuid
Brock Pytlik <bpytlik@sun.com>
parents: 1054
diff changeset
  2324
                        self.assert_(correct_answer == proposed_answer)
941
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
  2325
1081
0cc3e524ea7f 8318 search v1 not sending uuid
Brock Pytlik <bpytlik@sun.com>
parents: 1054
diff changeset
  2326
        def _search_op(self, api_obj, remote, token, test_value,
0cc3e524ea7f 8318 search v1 not sending uuid
Brock Pytlik <bpytlik@sun.com>
parents: 1054
diff changeset
  2327
            case_sensitive=False, return_actions=True, num_to_return=None,
0cc3e524ea7f 8318 search v1 not sending uuid
Brock Pytlik <bpytlik@sun.com>
parents: 1054
diff changeset
  2328
            start_point=None, servers=None):
0cc3e524ea7f 8318 search v1 not sending uuid
Brock Pytlik <bpytlik@sun.com>
parents: 1054
diff changeset
  2329
                search_func = api_obj.local_search
0cc3e524ea7f 8318 search v1 not sending uuid
Brock Pytlik <bpytlik@sun.com>
parents: 1054
diff changeset
  2330
                query = api.Query(token, case_sensitive, return_actions,
0cc3e524ea7f 8318 search v1 not sending uuid
Brock Pytlik <bpytlik@sun.com>
parents: 1054
diff changeset
  2331
                    num_to_return, start_point)
1325
0cb607b76761 10690 package installed from non-preferred pub include pub prefix in name token
Brock Pytlik <bpytlik@sun.com>
parents: 1291
diff changeset
  2332
                if remote:
0cb607b76761 10690 package installed from non-preferred pub include pub prefix in name token
Brock Pytlik <bpytlik@sun.com>
parents: 1291
diff changeset
  2333
                        search_func = api_obj.remote_search
0cb607b76761 10690 package installed from non-preferred pub include pub prefix in name token
Brock Pytlik <bpytlik@sun.com>
parents: 1291
diff changeset
  2334
                        res = set(TestApiSearchBasics._extract_action_from_res(
0cb607b76761 10690 package installed from non-preferred pub include pub prefix in name token
Brock Pytlik <bpytlik@sun.com>
parents: 1291
diff changeset
  2335
                            search_func([query], servers=servers)))
0cb607b76761 10690 package installed from non-preferred pub include pub prefix in name token
Brock Pytlik <bpytlik@sun.com>
parents: 1291
diff changeset
  2336
                else:
0cb607b76761 10690 package installed from non-preferred pub include pub prefix in name token
Brock Pytlik <bpytlik@sun.com>
parents: 1291
diff changeset
  2337
                        res = set(TestApiSearchBasics._extract_action_from_res(
0cb607b76761 10690 package installed from non-preferred pub include pub prefix in name token
Brock Pytlik <bpytlik@sun.com>
parents: 1291
diff changeset
  2338
                            search_func([query])))
1081
0cc3e524ea7f 8318 search v1 not sending uuid
Brock Pytlik <bpytlik@sun.com>
parents: 1054
diff changeset
  2339
                self._check(set(res), test_value)
0cc3e524ea7f 8318 search v1 not sending uuid
Brock Pytlik <bpytlik@sun.com>
parents: 1054
diff changeset
  2340
941
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
  2341
        def test_bug_2955(self):
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
  2342
                """See http://defect.opensolaris.org/bz/show_bug.cgi?id=2955"""
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
  2343
                progresstracker = progress.NullProgressTracker()
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
  2344
                api_obj = api.ImageInterface(self.get_img_path(), API_VERSION,
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
  2345
                    progresstracker, lambda x: False, PKG_CLIENT_NAME)
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
  2346
                TestApiSearchBasics._do_install(api_obj, ["example_pkg"])
1325
0cb607b76761 10690 package installed from non-preferred pub include pub prefix in name token
Brock Pytlik <bpytlik@sun.com>
parents: 1291
diff changeset
  2347
                # Test for bug 10690 by checking whether the fmri names
0cb607b76761 10690 package installed from non-preferred pub include pub prefix in name token
Brock Pytlik <bpytlik@sun.com>
parents: 1291
diff changeset
  2348
                # for packages installed from the non-preferred publisher
0cb607b76761 10690 package installed from non-preferred pub include pub prefix in name token
Brock Pytlik <bpytlik@sun.com>
parents: 1291
diff changeset
  2349
                # are parsed correctly. Specifically, test whether the name
0cb607b76761 10690 package installed from non-preferred pub include pub prefix in name token
Brock Pytlik <bpytlik@sun.com>
parents: 1291
diff changeset
  2350
                # alone is searchable, as well as the publisher/name
0cb607b76761 10690 package installed from non-preferred pub include pub prefix in name token
Brock Pytlik <bpytlik@sun.com>
parents: 1291
diff changeset
  2351
                # combination.
0cb607b76761 10690 package installed from non-preferred pub include pub prefix in name token
Brock Pytlik <bpytlik@sun.com>
parents: 1291
diff changeset
  2352
                self._search_op(api_obj, False, "set::test2/example_pkg",
0cb607b76761 10690 package installed from non-preferred pub include pub prefix in name token
Brock Pytlik <bpytlik@sun.com>
parents: 1291
diff changeset
  2353
                    self.res_alternate_server_local)
0cb607b76761 10690 package installed from non-preferred pub include pub prefix in name token
Brock Pytlik <bpytlik@sun.com>
parents: 1291
diff changeset
  2354
                self._search_op(api_obj, False, "set::example_pkg",
0cb607b76761 10690 package installed from non-preferred pub include pub prefix in name token
Brock Pytlik <bpytlik@sun.com>
parents: 1291
diff changeset
  2355
                    self.res_alternate_server_local)
0cb607b76761 10690 package installed from non-preferred pub include pub prefix in name token
Brock Pytlik <bpytlik@sun.com>
parents: 1291
diff changeset
  2356
                self._search_op(api_obj, False, "set::test2/*",
0cb607b76761 10690 package installed from non-preferred pub include pub prefix in name token
Brock Pytlik <bpytlik@sun.com>
parents: 1291
diff changeset
  2357
                    self.res_alternate_server_local)
941
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
  2358
                api_obj.rebuild_search_index()
1325
0cb607b76761 10690 package installed from non-preferred pub include pub prefix in name token
Brock Pytlik <bpytlik@sun.com>
parents: 1291
diff changeset
  2359
                self._search_op(api_obj, False, "set::test2/example_pkg",
0cb607b76761 10690 package installed from non-preferred pub include pub prefix in name token
Brock Pytlik <bpytlik@sun.com>
parents: 1291
diff changeset
  2360
                    self.res_alternate_server_local)
0cb607b76761 10690 package installed from non-preferred pub include pub prefix in name token
Brock Pytlik <bpytlik@sun.com>
parents: 1291
diff changeset
  2361
                self._search_op(api_obj, False, "set::example_pkg",
0cb607b76761 10690 package installed from non-preferred pub include pub prefix in name token
Brock Pytlik <bpytlik@sun.com>
parents: 1291
diff changeset
  2362
                    self.res_alternate_server_local)
0cb607b76761 10690 package installed from non-preferred pub include pub prefix in name token
Brock Pytlik <bpytlik@sun.com>
parents: 1291
diff changeset
  2363
                self._search_op(api_obj, False, "set::test2/*",
0cb607b76761 10690 package installed from non-preferred pub include pub prefix in name token
Brock Pytlik <bpytlik@sun.com>
parents: 1291
diff changeset
  2364
                    self.res_alternate_server_local)
941
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
  2365
                TestApiSearchBasics._do_uninstall(api_obj, ["example_pkg"])
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
  2366
1081
0cc3e524ea7f 8318 search v1 not sending uuid
Brock Pytlik <bpytlik@sun.com>
parents: 1054
diff changeset
  2367
        def test_bug_8318(self):
0cc3e524ea7f 8318 search v1 not sending uuid
Brock Pytlik <bpytlik@sun.com>
parents: 1054
diff changeset
  2368
                progresstracker = progress.NullProgressTracker()
0cc3e524ea7f 8318 search v1 not sending uuid
Brock Pytlik <bpytlik@sun.com>
parents: 1054
diff changeset
  2369
                api_obj = api.ImageInterface(self.get_img_path(), API_VERSION,
0cc3e524ea7f 8318 search v1 not sending uuid
Brock Pytlik <bpytlik@sun.com>
parents: 1054
diff changeset
  2370
                    progresstracker, lambda x: True, PKG_CLIENT_NAME)
1431
62b6033670e4 10416 server catalog v1 support desired
Shawn Walker <srw@sun.com>
parents: 1423
diff changeset
  2371
1081
0cc3e524ea7f 8318 search v1 not sending uuid
Brock Pytlik <bpytlik@sun.com>
parents: 1054
diff changeset
  2372
                self._search_op(api_obj, True,
0cc3e524ea7f 8318 search v1 not sending uuid
Brock Pytlik <bpytlik@sun.com>
parents: 1054
diff changeset
  2373
                    "this_should_not_match_any_token", set())
0cc3e524ea7f 8318 search v1 not sending uuid
Brock Pytlik <bpytlik@sun.com>
parents: 1054
diff changeset
  2374
                self._search_op(api_obj, True, "example_path",
0cc3e524ea7f 8318 search v1 not sending uuid
Brock Pytlik <bpytlik@sun.com>
parents: 1054
diff changeset
  2375
                    set(), servers=[{"origin": self.durl1}])
0cc3e524ea7f 8318 search v1 not sending uuid
Brock Pytlik <bpytlik@sun.com>
parents: 1054
diff changeset
  2376
                self._search_op(api_obj, True, "example_path",
0cc3e524ea7f 8318 search v1 not sending uuid
Brock Pytlik <bpytlik@sun.com>
parents: 1054
diff changeset
  2377
                    set(), servers=[{"origin": self.durl3}])
1431
62b6033670e4 10416 server catalog v1 support desired
Shawn Walker <srw@sun.com>
parents: 1423
diff changeset
  2378
                num_expected = { 1: 7, 2: 4, 3: 0 }
1081
0cc3e524ea7f 8318 search v1 not sending uuid
Brock Pytlik <bpytlik@sun.com>
parents: 1054
diff changeset
  2379
                for d in range(1,(len(self.dcs) + 1)):
0cc3e524ea7f 8318 search v1 not sending uuid
Brock Pytlik <bpytlik@sun.com>
parents: 1054
diff changeset
  2380
                        try:
0cc3e524ea7f 8318 search v1 not sending uuid
Brock Pytlik <bpytlik@sun.com>
parents: 1054
diff changeset
  2381
                                pub = api_obj.img.get_publisher(
0cc3e524ea7f 8318 search v1 not sending uuid
Brock Pytlik <bpytlik@sun.com>
parents: 1054
diff changeset
  2382
                                    origin=self.dcs[d].get_depot_url())
0cc3e524ea7f 8318 search v1 not sending uuid
Brock Pytlik <bpytlik@sun.com>
parents: 1054
diff changeset
  2383
                                c_uuid = pub.client_uuid
0cc3e524ea7f 8318 search v1 not sending uuid
Brock Pytlik <bpytlik@sun.com>
parents: 1054
diff changeset
  2384
                        except api_errors.UnknownPublisher:
0cc3e524ea7f 8318 search v1 not sending uuid
Brock Pytlik <bpytlik@sun.com>
parents: 1054
diff changeset
  2385
                                c_uuid = None
0cc3e524ea7f 8318 search v1 not sending uuid
Brock Pytlik <bpytlik@sun.com>
parents: 1054
diff changeset
  2386
                        lfh = file(self.dcs[d].get_logpath(), "rb")
0cc3e524ea7f 8318 search v1 not sending uuid
Brock Pytlik <bpytlik@sun.com>
parents: 1054
diff changeset
  2387
                        found = 0
0cc3e524ea7f 8318 search v1 not sending uuid
Brock Pytlik <bpytlik@sun.com>
parents: 1054
diff changeset
  2388
                        for line in lfh:
0cc3e524ea7f 8318 search v1 not sending uuid
Brock Pytlik <bpytlik@sun.com>
parents: 1054
diff changeset
  2389
                                if "X-IPKG-UUID:" in line:
0cc3e524ea7f 8318 search v1 not sending uuid
Brock Pytlik <bpytlik@sun.com>
parents: 1054
diff changeset
  2390
                                        tmp = line.split()
0cc3e524ea7f 8318 search v1 not sending uuid
Brock Pytlik <bpytlik@sun.com>
parents: 1054
diff changeset
  2391
                                        s_uuid = tmp[1]
0cc3e524ea7f 8318 search v1 not sending uuid
Brock Pytlik <bpytlik@sun.com>
parents: 1054
diff changeset
  2392
                                        if s_uuid != c_uuid:
0cc3e524ea7f 8318 search v1 not sending uuid
Brock Pytlik <bpytlik@sun.com>
parents: 1054
diff changeset
  2393
                                                raise RuntimeError(
0cc3e524ea7f 8318 search v1 not sending uuid
Brock Pytlik <bpytlik@sun.com>
parents: 1054
diff changeset
  2394
                                                    "Found uuid:%s doesn't "
0cc3e524ea7f 8318 search v1 not sending uuid
Brock Pytlik <bpytlik@sun.com>
parents: 1054
diff changeset
  2395
                                                    "match expected uuid:%s, "
0cc3e524ea7f 8318 search v1 not sending uuid
Brock Pytlik <bpytlik@sun.com>
parents: 1054
diff changeset
  2396
                                                    "d:%s, durl:%s" %
0cc3e524ea7f 8318 search v1 not sending uuid
Brock Pytlik <bpytlik@sun.com>
parents: 1054
diff changeset
  2397
                                                    (s_uuid, c_uuid, d,
0cc3e524ea7f 8318 search v1 not sending uuid
Brock Pytlik <bpytlik@sun.com>
parents: 1054
diff changeset
  2398
                                                    self.dcs[d].get_depot_url()))
0cc3e524ea7f 8318 search v1 not sending uuid
Brock Pytlik <bpytlik@sun.com>
parents: 1054
diff changeset
  2399
                                        found += 1
0cc3e524ea7f 8318 search v1 not sending uuid
Brock Pytlik <bpytlik@sun.com>
parents: 1054
diff changeset
  2400
                        if found != num_expected[d]:
0cc3e524ea7f 8318 search v1 not sending uuid
Brock Pytlik <bpytlik@sun.com>
parents: 1054
diff changeset
  2401
                                raise RuntimeError("d:%s, found %s instances of"
0cc3e524ea7f 8318 search v1 not sending uuid
Brock Pytlik <bpytlik@sun.com>
parents: 1054
diff changeset
  2402
                                    " a client uuid, expected to find %s." %
0cc3e524ea7f 8318 search v1 not sending uuid
Brock Pytlik <bpytlik@sun.com>
parents: 1054
diff changeset
  2403
                                    (d, found, num_expected[d]))
0cc3e524ea7f 8318 search v1 not sending uuid
Brock Pytlik <bpytlik@sun.com>
parents: 1054
diff changeset
  2404
941
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
  2405
if __name__ == "__main__":
e7bff46da54e 6175 search needs to be moved to version 1
Brock Pytlik <bpytlik@sun.com>
parents:
diff changeset
  2406
        unittest.main()