~vila/ols-store-tests/redirection-failures

« back to all changes in this revision

Viewing changes to tests/api/snap/test_snap_release.py

  • Committer: Ubuntu One Auto Copilot
  • Author(s): Vincent Ladeuil
  • Date: 2017-03-06 13:07:23 UTC
  • mfrom: (39.1.4 store-acceptance-tests)
  • Revision ID: otto-copilot@canonical.com-20170306130723-ldwaskone3acl2bp
Display log when test_release_snap_successful fails.
  
Use ols-run-tests to display test names and timings when running on jenkaas.
  
Properly isolate pip3 by using the virtualenv one rather than the system one.

Show diffs side-by-side

added added

removed removed

Lines of Context:
3
3
import time
4
4
import uuid
5
5
 
 
6
 
6
7
import requests
7
8
 
8
9
from .helpers import (
9
10
    SCA_ROOT_URL,
10
11
    APITestCase,
11
12
    authenticate_with_macaroon,
 
13
    log_on_failure,
12
14
    upload_snap,
13
15
)
14
16
from .test_register_name import register_name
15
17
from .test_snap_push import push_snap
16
18
 
17
19
 
 
20
logger = logging.getLogger(__name__)
 
21
 
 
22
 
18
23
RELEASE_SNAP_RETRY_WAIT = 30
19
24
 
20
25
 
41
46
        if status_url is not None:
42
47
            response = poll_until_processed(status_url)
43
48
        else:
44
 
            logging.info(
 
49
            logger.info(
45
50
                'Failed to release: data=%s. Retrying in %s seconds.',
46
51
                data, RELEASE_SNAP_RETRY_WAIT)
47
52
            time.sleep(RELEASE_SNAP_RETRY_WAIT)
61
66
def get_snap_status(status_url):
62
67
    response = requests.get(status_url, headers={'Cache-Control': 'no-cache'})
63
68
    if not response.ok:
64
 
        logging.error('Failed to get snap status. Response was: [%s] %s',
65
 
                      response.status_code, response.content)
 
69
        logger.error('Failed to get snap status. Response was: [%s] %s',
 
70
                     response.status_code, response.content)
66
71
    return response
67
72
 
68
73
 
95
100
        cls.auth = authenticate_with_macaroon()
96
101
 
97
102
    def setUp(self):
98
 
        super(SnapReleaseTestCase, self).setUp()
 
103
        super().setUp()
99
104
 
100
105
        # use same format for package names as snapcraft integration tests
101
106
        self.name = 'delete-me-{}'.format(str(uuid.uuid4().int)[:32])
143
148
        }
144
149
        self.assertEqual(body, expected)
145
150
 
 
151
    @log_on_failure
146
152
    def test_release_snap_successful(self):
147
153
        response = register_name(self.name, auth=self.auth)
148
154
        updown_id, version = upload_snap(self.name)