Convert user and project IDs from UUIDs to Strings

Change-Id: Ib7e65be82cebe78761c77db667c15fedff1df05e
Closes-Bug: #1505984
This commit is contained in:
Sam Morrison
2016-01-20 15:59:54 +11:00
parent f3dd101e36
commit d4f87da5d8
13 changed files with 592 additions and 398 deletions

View File

@@ -0,0 +1,249 @@
# Copyright 2016 OpenStack Foundation
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
#
"""Change uuid to string
Revision ID: 62a8dfb139bb
Revises: 1f21cbdd6bc2
Create Date: 2016-01-20 11:57:45.954607
"""
from alembic import op
import sqlalchemy as sa
import sqlalchemy_utils
# revision identifiers, used by Alembic.
revision = '62a8dfb139bb'
down_revision = '1f21cbdd6bc2'
branch_labels = None
depends_on = None
resourcehelper = sa.Table(
'resource',
sa.MetaData(),
sa.Column('id',
sqlalchemy_utils.types.uuid.UUIDType(binary=True),
nullable=False),
sa.Column('tmp_created_by_user_id',
sqlalchemy_utils.types.uuid.UUIDType(binary=True),
nullable=True),
sa.Column('tmp_created_by_project_id',
sqlalchemy_utils.types.uuid.UUIDType(binary=True),
nullable=True),
sa.Column('tmp_user_id',
sqlalchemy_utils.types.uuid.UUIDType(binary=True),
nullable=True),
sa.Column('tmp_project_id',
sqlalchemy_utils.types.uuid.UUIDType(binary=True),
nullable=True),
sa.Column('created_by_user_id',
sa.String(length=255),
nullable=True),
sa.Column('created_by_project_id',
sa.String(length=255),
nullable=True),
sa.Column('user_id',
sa.String(length=255),
nullable=True),
sa.Column('project_id',
sa.String(length=255),
nullable=True),
)
resourcehistoryhelper = sa.Table(
'resource_history',
sa.MetaData(),
sa.Column('id',
sqlalchemy_utils.types.uuid.UUIDType(binary=True),
nullable=False),
sa.Column('tmp_created_by_user_id',
sqlalchemy_utils.types.uuid.UUIDType(binary=True),
nullable=True),
sa.Column('tmp_created_by_project_id',
sqlalchemy_utils.types.uuid.UUIDType(binary=True),
nullable=True),
sa.Column('tmp_user_id',
sqlalchemy_utils.types.uuid.UUIDType(binary=True),
nullable=True),
sa.Column('tmp_project_id',
sqlalchemy_utils.types.uuid.UUIDType(binary=True),
nullable=True),
sa.Column('created_by_user_id',
sa.String(length=255),
nullable=True),
sa.Column('created_by_project_id',
sa.String(length=255),
nullable=True),
sa.Column('user_id',
sa.String(length=255),
nullable=True),
sa.Column('project_id',
sa.String(length=255),
nullable=True),
)
metrichelper = sa.Table(
'metric',
sa.MetaData(),
sa.Column('id',
sqlalchemy_utils.types.uuid.UUIDType(binary=True),
nullable=False),
sa.Column('tmp_created_by_user_id',
sqlalchemy_utils.types.uuid.UUIDType(binary=True),
nullable=True),
sa.Column('tmp_created_by_project_id',
sqlalchemy_utils.types.uuid.UUIDType(binary=True),
nullable=True),
sa.Column('created_by_user_id',
sa.String(length=255),
nullable=True),
sa.Column('created_by_project_id',
sa.String(length=255),
nullable=True),
)
def upgrade():
connection = op.get_bind()
# Rename user/project fields to tmp_*
op.alter_column('metric', 'created_by_project_id',
new_column_name='tmp_created_by_project_id',
existing_type=sa.BINARY(length=16))
op.alter_column('metric', 'created_by_user_id',
new_column_name='tmp_created_by_user_id',
existing_type=sa.BINARY(length=16))
op.alter_column('resource', 'created_by_project_id',
new_column_name='tmp_created_by_project_id',
existing_type=sa.BINARY(length=16))
op.alter_column('resource', 'created_by_user_id',
new_column_name='tmp_created_by_user_id',
existing_type=sa.BINARY(length=16))
op.alter_column('resource', 'project_id',
new_column_name='tmp_project_id',
existing_type=sa.BINARY(length=16))
op.alter_column('resource', 'user_id',
new_column_name='tmp_user_id',
existing_type=sa.BINARY(length=16))
op.alter_column('resource_history', 'created_by_project_id',
new_column_name='tmp_created_by_project_id',
existing_type=sa.BINARY(length=16))
op.alter_column('resource_history', 'created_by_user_id',
new_column_name='tmp_created_by_user_id',
existing_type=sa.BINARY(length=16))
op.alter_column('resource_history', 'project_id',
new_column_name='tmp_project_id',
existing_type=sa.BINARY(length=16))
op.alter_column('resource_history', 'user_id',
new_column_name='tmp_user_id',
existing_type=sa.BINARY(length=16))
# Add new user/project fields as strings
op.add_column('metric',
sa.Column('created_by_project_id',
sa.String(length=255), nullable=True))
op.add_column('metric',
sa.Column('created_by_user_id',
sa.String(length=255), nullable=True))
op.add_column('resource',
sa.Column('created_by_project_id',
sa.String(length=255), nullable=True))
op.add_column('resource',
sa.Column('created_by_user_id',
sa.String(length=255), nullable=True))
op.add_column('resource',
sa.Column('project_id',
sa.String(length=255), nullable=True))
op.add_column('resource',
sa.Column('user_id',
sa.String(length=255), nullable=True))
op.add_column('resource_history',
sa.Column('created_by_project_id',
sa.String(length=255), nullable=True))
op.add_column('resource_history',
sa.Column('created_by_user_id',
sa.String(length=255), nullable=True))
op.add_column('resource_history',
sa.Column('project_id',
sa.String(length=255), nullable=True))
op.add_column('resource_history',
sa.Column('user_id',
sa.String(length=255), nullable=True))
# Migrate data
for tablehelper in [resourcehelper, resourcehistoryhelper]:
for resource in connection.execute(tablehelper.select()):
if resource.tmp_created_by_project_id:
created_by_project_id = \
str(resource.tmp_created_by_project_id).replace('-', '')
else:
created_by_project_id = None
if resource.tmp_created_by_user_id:
created_by_user_id = \
str(resource.tmp_created_by_user_id).replace('-', '')
else:
created_by_user_id = None
if resource.tmp_project_id:
project_id = str(resource.tmp_project_id).replace('-', '')
else:
project_id = None
if resource.tmp_user_id:
user_id = str(resource.tmp_user_id).replace('-', '')
else:
user_id = None
connection.execute(
tablehelper.update().where(
tablehelper.c.id == resource.id
).values(
created_by_project_id=created_by_project_id,
created_by_user_id=created_by_user_id,
project_id=project_id,
user_id=user_id,
)
)
for metric in connection.execute(metrichelper.select()):
if resource.tmp_created_by_project_id:
created_by_project_id = \
str(resource.tmp_created_by_project_id).replace('-', '')
else:
created_by_project_id = None
if resource.tmp_created_by_user_id:
created_by_user_id = \
str(resource.tmp_created_by_user_id).replace('-', '')
else:
created_by_user_id = None
connection.execute(
metrichelper.update().where(
metrichelper.c.id == metric.id
).values(
created_by_project_id=created_by_project_id,
created_by_user_id=created_by_user_id,
)
)
# Delete temp fields
op.drop_column('metric', 'tmp_created_by_project_id')
op.drop_column('metric', 'tmp_created_by_user_id')
op.drop_column('resource', 'tmp_created_by_project_id')
op.drop_column('resource', 'tmp_created_by_user_id')
op.drop_column('resource', 'tmp_project_id')
op.drop_column('resource', 'tmp_user_id')
op.drop_column('resource_history', 'tmp_created_by_project_id')
op.drop_column('resource_history', 'tmp_created_by_user_id')
op.drop_column('resource_history', 'tmp_project_id')
op.drop_column('resource_history', 'tmp_user_id')

View File

@@ -153,9 +153,9 @@ class Metric(Base, GnocchiBase, storage.Metric):
nullable=False)
archive_policy = sqlalchemy.orm.relationship(ArchivePolicy, lazy="joined")
created_by_user_id = sqlalchemy.Column(
sqlalchemy_utils.UUIDType())
sqlalchemy.String(255))
created_by_project_id = sqlalchemy.Column(
sqlalchemy_utils.UUIDType())
sqlalchemy.String(255))
resource_id = sqlalchemy.Column(
sqlalchemy_utils.UUIDType(),
sqlalchemy.ForeignKey('resource.id',
@@ -229,9 +229,9 @@ class ResourceMixin(ResourceJsonifier):
name="resource_type_enum"),
nullable=False, default='generic')
created_by_user_id = sqlalchemy.Column(
sqlalchemy_utils.UUIDType())
sqlalchemy.String(255))
created_by_project_id = sqlalchemy.Column(
sqlalchemy_utils.UUIDType())
sqlalchemy.String(255))
started_at = sqlalchemy.Column(PreciseTimestamp, nullable=False,
# NOTE(jd): We would like to use
# sqlalchemy.func.now, but we can't
@@ -243,8 +243,8 @@ class ResourceMixin(ResourceJsonifier):
revision_start = sqlalchemy.Column(PreciseTimestamp, nullable=False,
default=lambda: utils.utcnow())
ended_at = sqlalchemy.Column(PreciseTimestamp)
user_id = sqlalchemy.Column(sqlalchemy_utils.UUIDType())
project_id = sqlalchemy.Column(sqlalchemy_utils.UUIDType())
user_id = sqlalchemy.Column(sqlalchemy.String(255))
project_id = sqlalchemy.Column(sqlalchemy.String(255))
class Resource(ResourceMixin, Base, GnocchiBase):

View File

@@ -71,14 +71,12 @@ def list_opts():
'resource_id',
type=uuid.UUID,
help='Resource UUID to use to identify statsd in Gnocchi'),
cfg.Opt(
cfg.StrOpt(
'user_id',
type=uuid.UUID,
help='User UUID to use to identify statsd in Gnocchi'),
cfg.Opt(
help='User ID to use to identify statsd in Gnocchi'),
cfg.StrOpt(
'project_id',
type=uuid.UUID,
help='Project UUID to use to identify statsd in Gnocchi'),
help='Project ID to use to identify statsd in Gnocchi'),
cfg.StrOpt(
'archive_policy_name',
help='Archive policy name to use when creating metrics'),

View File

@@ -51,24 +51,8 @@ def abort(status_code, detail='', headers=None, comment=None, **kw):
def get_user_and_project():
headers = pecan.request.headers
# NOTE(jd) If user_id or project_id is UUID, try to convert them into
# the proper dashed format. It's indeed possible that a middleware passes
# these UUIDs without the dash representation. It's valid, we can parse,
# but the policy module won't see the equality in the string
# representations.
user_id = headers.get("X-User-Id")
if user_id:
try:
user_id = six.text_type(uuid.UUID(user_id))
except Exception:
abort(400, "Malformed X-User-Id")
project_id = headers.get("X-Project-Id")
if project_id:
try:
project_id = six.text_type(uuid.UUID(project_id))
except Exception:
abort(400, "Malformed X-Project-Id")
return (user_id, project_id)
@@ -540,8 +524,8 @@ class MetricsController(rest.RestController):
return MetricController(metrics[0]), remainder
_MetricSchema = voluptuous.Schema({
"user_id": UUID,
"project_id": UUID,
"user_id": six.text_type,
"project_id": six.text_type,
"archive_policy_name": six.text_type,
"name": six.text_type,
})
@@ -759,8 +743,8 @@ def ResourceSchema(schema):
"id": utils.ResourceUUID,
voluptuous.Optional('started_at'): Timestamp,
voluptuous.Optional('ended_at'): Timestamp,
voluptuous.Optional('user_id'): voluptuous.Any(None, UUID),
voluptuous.Optional('project_id'): voluptuous.Any(None, UUID),
voluptuous.Optional('user_id'): voluptuous.Any(None, six.text_type),
voluptuous.Optional('project_id'): voluptuous.Any(None, six.text_type),
voluptuous.Optional('metrics'): MetricsSchema,
}
base_schema.update(schema)

View File

@@ -1,39 +0,0 @@
#
# Gabbi tests for investigating authentication and authorization
# related error conditions. These are without keystonemiddleware in
# place and are effectively testing situations that would only
# happen if the middleware was behaving oddly or not present.
#
fixtures:
- ConfigFixture
tests:
# A project-id or user-id that is not a uuid should cause a 400.
- name: bad project-id when creating resource
url: /v1/resource/generic
method: post
request_headers:
content-type: application/json
x-user-id: 93180da9-7c15-40d3-a050-a374551e52ee
x-project-id: 99d13f22
data:
id: 5b7ebe90-4ad2-4c83-ad2c-f6344884ab70
status: 400
response_strings:
- Malformed X-Project-Id
- name: bad user-id when creating resource
url: /v1/resource/generic
method: post
request_headers:
content-type: application/json
x-user-id: 93180da9
x-project-id: 99d13f22-3618-4288-82b8-6512ded77e4f
data:
id: 5b7ebe90-4ad2-4c83-ad2c-f6344884ab70
status: 400
response_strings:
- Malformed X-User-Id

View File

@@ -110,15 +110,15 @@ tests:
data:
id: 5b7ebe90-4ad2-4c83-ad2c-f6344884ab70
started_at: "2014-01-03T02:02:02.000000"
user_id: 0fbb2314-8461-4b1a-8013-1fc22f6afc9c
project_id: f3d41b77-0cc1-4f0b-b94a-1d5be9c0e3ea
user_id: 0fbb231484614b1a80131fc22f6afc9c
project_id: f3d41b770cc14f0bb94a1d5be9c0e3ea
status: 201
response_headers:
location: $SCHEME://$NETLOC/v1/resource/generic/5b7ebe90-4ad2-4c83-ad2c-f6344884ab70
response_json_paths:
type: generic
started_at: "2014-01-03T02:02:02+00:00"
project_id: f3d41b77-0cc1-4f0b-b94a-1d5be9c0e3ea
project_id: f3d41b770cc14f0bb94a1d5be9c0e3ea
created_by_project_id: 99d13f22-3618-4288-82b8-6512ded77e4f
- name: get status denied

View File

@@ -26,44 +26,44 @@ tests:
url: /v1/resource/generic
method: post
request_headers:
x-user-id: 0fbb2314-8461-4b1a-8013-1fc22f6afc9c
x-project-id: f3d41b77-0cc1-4f0b-b94a-1d5be9c0e3ea
x-user-id: 0fbb231484614b1a80131fc22f6afc9c
x-project-id: f3d41b770cc14f0bb94a1d5be9c0e3ea
content-type: application/json
data:
id: f93450f2-d8a5-4d67-9985-02511241e7d1
started_at: "2014-01-03T02:02:02.000000"
user_id: 0fbb2314-8461-4b1a-8013-1fc22f6afc9c
project_id: f3d41b77-0cc1-4f0b-b94a-1d5be9c0e3ea
user_id: 0fbb231484614b1a80131fc22f6afc9c
project_id: f3d41b770cc14f0bb94a1d5be9c0e3ea
status: 201
response_headers:
location: $SCHEME://$NETLOC/v1/resource/generic/f93450f2-d8a5-4d67-9985-02511241e7d1
content-type: application/json; charset=UTF-8
response_json_paths:
$.created_by_project_id: f3d41b77-0cc1-4f0b-b94a-1d5be9c0e3ea
$.created_by_user_id: 0fbb2314-8461-4b1a-8013-1fc22f6afc9c
$.user_id: 0fbb2314-8461-4b1a-8013-1fc22f6afc9c
$.created_by_project_id: f3d41b770cc14f0bb94a1d5be9c0e3ea
$.created_by_user_id: 0fbb231484614b1a80131fc22f6afc9c
$.user_id: 0fbb231484614b1a80131fc22f6afc9c
# Update it twice
- name: patch resource user_id
url: /v1/resource/generic/f93450f2-d8a5-4d67-9985-02511241e7d1
method: patch
request_headers:
x-user-id: 0fbb2314-8461-4b1a-8013-1fc22f6afc9c
x-project-id: f3d41b77-0cc1-4f0b-b94a-1d5be9c0e3ea
x-user-id: 0fbb231484614b1a80131fc22f6afc9c
x-project-id: f3d41b770cc14f0bb94a1d5be9c0e3ea
content-type: application/json
data:
user_id: f53c58a4-fdea-4c09-aac4-02135900be67
status: 200
response_json_paths:
user_id: f53c58a4-fdea-4c09-aac4-02135900be67
project_id: f3d41b77-0cc1-4f0b-b94a-1d5be9c0e3ea
project_id: f3d41b770cc14f0bb94a1d5be9c0e3ea
- name: patch resource project_id
url: /v1/resource/generic/f93450f2-d8a5-4d67-9985-02511241e7d1
method: patch
request_headers:
x-user-id: 0fbb2314-8461-4b1a-8013-1fc22f6afc9c
x-project-id: f3d41b77-0cc1-4f0b-b94a-1d5be9c0e3ea
x-user-id: 0fbb231484614b1a80131fc22f6afc9c
x-project-id: f3d41b770cc14f0bb94a1d5be9c0e3ea
content-type: application/json
data:
project_id: fe20a931-1012-4cc6-addc-39556ec60907
@@ -80,8 +80,8 @@ tests:
- name: list all resources without history
url: /v1/resource/generic
request_headers:
x-user-id: 0fbb2314-8461-4b1a-8013-1fc22f6afc9c
x-project-id: f3d41b77-0cc1-4f0b-b94a-1d5be9c0e3ea
x-user-id: 0fbb231484614b1a80131fc22f6afc9c
x-project-id: f3d41b770cc14f0bb94a1d5be9c0e3ea
response_json_paths:
$[0].user_id: f53c58a4-fdea-4c09-aac4-02135900be67
$[0].project_id: fe20a931-1012-4cc6-addc-39556ec60907
@@ -90,16 +90,16 @@ tests:
url: /v1/resource/generic
request_headers:
accept: application/json; details=True; history=True
x-user-id: 0fbb2314-8461-4b1a-8013-1fc22f6afc9c
x-project-id: f3d41b77-0cc1-4f0b-b94a-1d5be9c0e3ea
x-user-id: 0fbb231484614b1a80131fc22f6afc9c
x-project-id: f3d41b770cc14f0bb94a1d5be9c0e3ea
response_json_paths:
$.`len`: 3
$[0].id: f93450f2-d8a5-4d67-9985-02511241e7d1
$[0].user_id: 0fbb2314-8461-4b1a-8013-1fc22f6afc9c
$[0].project_id: f3d41b77-0cc1-4f0b-b94a-1d5be9c0e3ea
$[0].user_id: 0fbb231484614b1a80131fc22f6afc9c
$[0].project_id: f3d41b770cc14f0bb94a1d5be9c0e3ea
$[1].id: f93450f2-d8a5-4d67-9985-02511241e7d1
$[1].user_id: f53c58a4-fdea-4c09-aac4-02135900be67
$[1].project_id: f3d41b77-0cc1-4f0b-b94a-1d5be9c0e3ea
$[1].project_id: f3d41b770cc14f0bb94a1d5be9c0e3ea
$[2].id: f93450f2-d8a5-4d67-9985-02511241e7d1
$[2].user_id: f53c58a4-fdea-4c09-aac4-02135900be67
$[2].project_id: fe20a931-1012-4cc6-addc-39556ec60907
@@ -108,8 +108,8 @@ tests:
url: /v1/resource/generic/f93450f2-d8a5-4d67-9985-02511241e7d1
method: patch
request_headers:
x-user-id: 0fbb2314-8461-4b1a-8013-1fc22f6afc9c
x-project-id: f3d41b77-0cc1-4f0b-b94a-1d5be9c0e3ea
x-user-id: 0fbb231484614b1a80131fc22f6afc9c
x-project-id: f3d41b770cc14f0bb94a1d5be9c0e3ea
content-type: application/json
data:
metrics:
@@ -121,16 +121,16 @@ tests:
url: /v1/resource/generic
request_headers:
accept: application/json; details=True; history=True
x-user-id: 0fbb2314-8461-4b1a-8013-1fc22f6afc9c
x-project-id: f3d41b77-0cc1-4f0b-b94a-1d5be9c0e3ea
x-user-id: 0fbb231484614b1a80131fc22f6afc9c
x-project-id: f3d41b770cc14f0bb94a1d5be9c0e3ea
response_json_paths:
$.`len`: 3
$[0].id: f93450f2-d8a5-4d67-9985-02511241e7d1
$[0].user_id: 0fbb2314-8461-4b1a-8013-1fc22f6afc9c
$[0].project_id: f3d41b77-0cc1-4f0b-b94a-1d5be9c0e3ea
$[0].user_id: 0fbb231484614b1a80131fc22f6afc9c
$[0].project_id: f3d41b770cc14f0bb94a1d5be9c0e3ea
$[1].id: f93450f2-d8a5-4d67-9985-02511241e7d1
$[1].user_id: f53c58a4-fdea-4c09-aac4-02135900be67
$[1].project_id: f3d41b77-0cc1-4f0b-b94a-1d5be9c0e3ea
$[1].project_id: f3d41b770cc14f0bb94a1d5be9c0e3ea
$[2].id: f93450f2-d8a5-4d67-9985-02511241e7d1
$[2].user_id: f53c58a4-fdea-4c09-aac4-02135900be67
$[2].project_id: fe20a931-1012-4cc6-addc-39556ec60907
@@ -139,8 +139,8 @@ tests:
url: /v1/resource/generic/f93450f2-d8a5-4d67-9985-02511241e7d1/metric
method: post
request_headers:
x-user-id: 0fbb2314-8461-4b1a-8013-1fc22f6afc9c
x-project-id: f3d41b77-0cc1-4f0b-b94a-1d5be9c0e3ea
x-user-id: 0fbb231484614b1a80131fc22f6afc9c
x-project-id: f3d41b770cc14f0bb94a1d5be9c0e3ea
content-type: application/json
data:
foobar:
@@ -151,16 +151,16 @@ tests:
url: /v1/resource/generic
request_headers:
accept: application/json; details=True; history=True
x-user-id: 0fbb2314-8461-4b1a-8013-1fc22f6afc9c
x-project-id: f3d41b77-0cc1-4f0b-b94a-1d5be9c0e3ea
x-user-id: 0fbb231484614b1a80131fc22f6afc9c
x-project-id: f3d41b770cc14f0bb94a1d5be9c0e3ea
response_json_paths:
$.`len`: 3
$[0].id: f93450f2-d8a5-4d67-9985-02511241e7d1
$[0].user_id: 0fbb2314-8461-4b1a-8013-1fc22f6afc9c
$[0].project_id: f3d41b77-0cc1-4f0b-b94a-1d5be9c0e3ea
$[0].user_id: 0fbb231484614b1a80131fc22f6afc9c
$[0].project_id: f3d41b770cc14f0bb94a1d5be9c0e3ea
$[1].id: f93450f2-d8a5-4d67-9985-02511241e7d1
$[1].user_id: f53c58a4-fdea-4c09-aac4-02135900be67
$[1].project_id: f3d41b77-0cc1-4f0b-b94a-1d5be9c0e3ea
$[1].project_id: f3d41b770cc14f0bb94a1d5be9c0e3ea
$[2].id: f93450f2-d8a5-4d67-9985-02511241e7d1
$[2].user_id: f53c58a4-fdea-4c09-aac4-02135900be67
$[2].project_id: fe20a931-1012-4cc6-addc-39556ec60907

View File

@@ -14,70 +14,70 @@ tests:
url: /v1/resource/generic
method: post
request_headers:
x-user-id: 0fbb2314-8461-4b1a-8013-1fc22f6afc9c
x-project-id: f3d41b77-0cc1-4f0b-b94a-1d5be9c0e3ea
x-user-id: 0fbb231484614b1a80131fc22f6afc9c
x-project-id: f3d41b770cc14f0bb94a1d5be9c0e3ea
content-type: application/json
data:
id: 57a9e836-87b8-4a21-9e30-18a474b98fef
started_at: "2014-01-01T02:02:02.000000"
user_id: 0fbb2314-8461-4b1a-8013-1fc22f6afc9c
project_id: f3d41b77-0cc1-4f0b-b94a-1d5be9c0e3ea
user_id: 0fbb231484614b1a80131fc22f6afc9c
project_id: f3d41b770cc14f0bb94a1d5be9c0e3ea
status: 201
- name: post resource 2
url: /v1/resource/generic
method: post
request_headers:
x-user-id: 0fbb2314-8461-4b1a-8013-1fc22f6afc9c
x-project-id: f3d41b77-0cc1-4f0b-b94a-1d5be9c0e3ea
x-user-id: 0fbb231484614b1a80131fc22f6afc9c
x-project-id: f3d41b770cc14f0bb94a1d5be9c0e3ea
content-type: application/json
data:
id: 4facbf7e-a900-406d-a828-82393f7006b3
started_at: "2014-01-02T02:02:02.000000"
user_id: 0fbb2314-8461-4b1a-8013-1fc22f6afc9c
project_id: f3d41b77-0cc1-4f0b-b94a-1d5be9c0e3ea
user_id: 0fbb231484614b1a80131fc22f6afc9c
project_id: f3d41b770cc14f0bb94a1d5be9c0e3ea
status: 201
- name: post resource 3
url: /v1/resource/generic
method: post
request_headers:
x-user-id: 0fbb2314-8461-4b1a-8013-1fc22f6afc9c
x-project-id: f3d41b77-0cc1-4f0b-b94a-1d5be9c0e3ea
x-user-id: 0fbb231484614b1a80131fc22f6afc9c
x-project-id: f3d41b770cc14f0bb94a1d5be9c0e3ea
content-type: application/json
data:
id: 36775172-ebc9-4060-9870-a649361bc3ab
started_at: "2014-01-03T02:02:02.000000"
user_id: 0fbb2314-8461-4b1a-8013-1fc22f6afc9c
project_id: f3d41b77-0cc1-4f0b-b94a-1d5be9c0e3ea
user_id: 0fbb231484614b1a80131fc22f6afc9c
project_id: f3d41b770cc14f0bb94a1d5be9c0e3ea
status: 201
- name: post resource 4
url: /v1/resource/generic
method: post
request_headers:
x-user-id: 0fbb2314-8461-4b1a-8013-1fc22f6afc9c
x-project-id: f3d41b77-0cc1-4f0b-b94a-1d5be9c0e3ea
x-user-id: 0fbb231484614b1a80131fc22f6afc9c
x-project-id: f3d41b770cc14f0bb94a1d5be9c0e3ea
content-type: application/json
data:
id: 28593168-52bb-43b5-a6db-fc2343aac02a
started_at: "2014-01-04T02:02:02.000000"
user_id: 0fbb2314-8461-4b1a-8013-1fc22f6afc9c
project_id: f3d41b77-0cc1-4f0b-b94a-1d5be9c0e3ea
user_id: 0fbb231484614b1a80131fc22f6afc9c
project_id: f3d41b770cc14f0bb94a1d5be9c0e3ea
status: 201
- name: post resource 5
url: /v1/resource/generic
method: post
request_headers:
x-user-id: 0fbb2314-8461-4b1a-8013-1fc22f6afc9c
x-project-id: f3d41b77-0cc1-4f0b-b94a-1d5be9c0e3ea
x-user-id: 0fbb231484614b1a80131fc22f6afc9c
x-project-id: f3d41b770cc14f0bb94a1d5be9c0e3ea
content-type: application/json
data:
id: 1e3d5702-2cbf-46e0-ba13-0ddaa3c71150
started_at: "2014-01-05T02:02:02.000000"
user_id: 0fbb2314-8461-4b1a-8013-1fc22f6afc9c
project_id: f3d41b77-0cc1-4f0b-b94a-1d5be9c0e3ea
user_id: 0fbb231484614b1a80131fc22f6afc9c
project_id: f3d41b770cc14f0bb94a1d5be9c0e3ea
status: 201
#
@@ -87,8 +87,8 @@ tests:
url: /v1/resource/generic?limit=2
method: get
request_headers:
x-user-id: 0fbb2314-8461-4b1a-8013-1fc22f6afc9c
x-project-id: f3d41b77-0cc1-4f0b-b94a-1d5be9c0e3ea
x-user-id: 0fbb231484614b1a80131fc22f6afc9c
x-project-id: f3d41b770cc14f0bb94a1d5be9c0e3ea
content-type: application/json
response_json_paths:
$.`len`: 2
@@ -99,8 +99,8 @@ tests:
url: /v1/resource/generic?limit=4&marker=4facbf7e-a900-406d-a828-82393f7006b3
method: get
request_headers:
x-user-id: 0fbb2314-8461-4b1a-8013-1fc22f6afc9c
x-project-id: f3d41b77-0cc1-4f0b-b94a-1d5be9c0e3ea
x-user-id: 0fbb231484614b1a80131fc22f6afc9c
x-project-id: f3d41b770cc14f0bb94a1d5be9c0e3ea
content-type: application/json
response_json_paths:
$.`len`: 3
@@ -112,8 +112,8 @@ tests:
url: /v1/resource/generic?limit=2&sort=id
method: get
request_headers:
x-user-id: 0fbb2314-8461-4b1a-8013-1fc22f6afc9c
x-project-id: f3d41b77-0cc1-4f0b-b94a-1d5be9c0e3ea
x-user-id: 0fbb231484614b1a80131fc22f6afc9c
x-project-id: f3d41b770cc14f0bb94a1d5be9c0e3ea
content-type: application/json
status: 200
response_json_paths:
@@ -125,8 +125,8 @@ tests:
url: /v1/resource/generic?limit=2&sort=id:asc
method: get
request_headers:
x-user-id: 0fbb2314-8461-4b1a-8013-1fc22f6afc9c
x-project-id: f3d41b77-0cc1-4f0b-b94a-1d5be9c0e3ea
x-user-id: 0fbb231484614b1a80131fc22f6afc9c
x-project-id: f3d41b770cc14f0bb94a1d5be9c0e3ea
content-type: application/json
response_json_paths:
$.`len`: 2
@@ -137,8 +137,8 @@ tests:
url: /v1/resource/generic?limit=4&sort=id:asc&marker=28593168-52bb-43b5-a6db-fc2343aac02a
method: get
request_headers:
x-user-id: 0fbb2314-8461-4b1a-8013-1fc22f6afc9c
x-project-id: f3d41b77-0cc1-4f0b-b94a-1d5be9c0e3ea
x-user-id: 0fbb231484614b1a80131fc22f6afc9c
x-project-id: f3d41b770cc14f0bb94a1d5be9c0e3ea
content-type: application/json
response_json_paths:
$.`len`: 3
@@ -150,8 +150,8 @@ tests:
url: /v1/search/resource/generic?limit=2&sort=id:asc&marker=36775172-ebc9-4060-9870-a649361bc3ab
method: POST
request_headers:
x-user-id: 0fbb2314-8461-4b1a-8013-1fc22f6afc9c
x-project-id: f3d41b77-0cc1-4f0b-b94a-1d5be9c0e3ea
x-user-id: 0fbb231484614b1a80131fc22f6afc9c
x-project-id: f3d41b770cc14f0bb94a1d5be9c0e3ea
content-type: application/json
data:
"or": [
@@ -171,8 +171,8 @@ tests:
url: /v1/resource/generic?sort=invalid:asc
method: get
request_headers:
x-user-id: 0fbb2314-8461-4b1a-8013-1fc22f6afc9c
x-project-id: f3d41b77-0cc1-4f0b-b94a-1d5be9c0e3ea
x-user-id: 0fbb231484614b1a80131fc22f6afc9c
x-project-id: f3d41b770cc14f0bb94a1d5be9c0e3ea
content-type: application/json
status: 400
@@ -180,8 +180,8 @@ tests:
url: /v1/resource/generic?sort=id:invalid
method: get
request_headers:
x-user-id: 0fbb2314-8461-4b1a-8013-1fc22f6afc9c
x-project-id: f3d41b77-0cc1-4f0b-b94a-1d5be9c0e3ea
x-user-id: 0fbb231484614b1a80131fc22f6afc9c
x-project-id: f3d41b770cc14f0bb94a1d5be9c0e3ea
content-type: application/json
status: 400
@@ -189,8 +189,8 @@ tests:
url: /v1/resource/generic?marker=d44b3f4c-27bc-4ace-b81c-2a8e60026874
method: get
request_headers:
x-user-id: 0fbb2314-8461-4b1a-8013-1fc22f6afc9c
x-project-id: f3d41b77-0cc1-4f0b-b94a-1d5be9c0e3ea
x-user-id: 0fbb231484614b1a80131fc22f6afc9c
x-project-id: f3d41b770cc14f0bb94a1d5be9c0e3ea
content-type: application/json
status: 400
@@ -198,8 +198,8 @@ tests:
url: /v1/resource/generic?limit=-2
method: get
request_headers:
x-user-id: 0fbb2314-8461-4b1a-8013-1fc22f6afc9c
x-project-id: f3d41b77-0cc1-4f0b-b94a-1d5be9c0e3ea
x-user-id: 0fbb231484614b1a80131fc22f6afc9c
x-project-id: f3d41b770cc14f0bb94a1d5be9c0e3ea
content-type: application/json
status: 400
@@ -207,8 +207,8 @@ tests:
url: /v1/resource/generic?limit=invalid
method: get
request_headers:
x-user-id: 0fbb2314-8461-4b1a-8013-1fc22f6afc9c
x-project-id: f3d41b77-0cc1-4f0b-b94a-1d5be9c0e3ea
x-user-id: 0fbb231484614b1a80131fc22f6afc9c
x-project-id: f3d41b770cc14f0bb94a1d5be9c0e3ea
content-type: application/json
status: 400
@@ -220,50 +220,50 @@ tests:
url: /v1/resource/generic
method: post
request_headers:
x-user-id: 0fbb2314-8461-4b1a-8013-1fc22f6afc9c
x-project-id: f3d41b77-0cc1-4f0b-b94a-1d5be9c0e3ea
x-user-id: 0fbb231484614b1a80131fc22f6afc9c
x-project-id: f3d41b770cc14f0bb94a1d5be9c0e3ea
content-type: application/json
data:
id: 465f87b2-61f7-4118-adec-1d96a78af401
started_at: "2014-01-02T02:02:02.000000"
user_id: 0fbb2314-8461-4b1a-8013-1fc22f6afc9c
project_id: f3d41b77-0cc1-4f0b-b94a-1d5be9c0e3ea
user_id: 0fbb231484614b1a80131fc22f6afc9c
project_id: f3d41b770cc14f0bb94a1d5be9c0e3ea
status: 201
- name: post resource 7
url: /v1/resource/generic
method: post
request_headers:
x-user-id: 0fbb2314-8461-4b1a-8013-1fc22f6afc9c
x-project-id: f3d41b77-0cc1-4f0b-b94a-1d5be9c0e3ea
x-user-id: 0fbb231484614b1a80131fc22f6afc9c
x-project-id: f3d41b770cc14f0bb94a1d5be9c0e3ea
content-type: application/json
data:
id: 9b6af245-57df-4ed6-a8c0-f64b77d8867f
started_at: "2014-01-28T02:02:02.000000"
user_id: 0fbb2314-8461-4b1a-8013-1fc22f6afc9c
project_id: f3d41b77-0cc1-4f0b-b94a-1d5be9c0e3ea
user_id: 0fbb231484614b1a80131fc22f6afc9c
project_id: f3d41b770cc14f0bb94a1d5be9c0e3ea
status: 201
- name: post resource 8
url: /v1/resource/generic
method: post
request_headers:
x-user-id: 0fbb2314-8461-4b1a-8013-1fc22f6afc9c
x-project-id: f3d41b77-0cc1-4f0b-b94a-1d5be9c0e3ea
x-user-id: 0fbb231484614b1a80131fc22f6afc9c
x-project-id: f3d41b770cc14f0bb94a1d5be9c0e3ea
content-type: application/json
data:
id: d787aa85-5743-4443-84f9-204270bc141a
started_at: "2014-01-31T02:02:02.000000"
user_id: 0fbb2314-8461-4b1a-8013-1fc22f6afc9c
project_id: f3d41b77-0cc1-4f0b-b94a-1d5be9c0e3ea
user_id: 0fbb231484614b1a80131fc22f6afc9c
project_id: f3d41b770cc14f0bb94a1d5be9c0e3ea
status: 201
- name: default limit
url: /v1/resource/generic
method: get
request_headers:
x-user-id: 0fbb2314-8461-4b1a-8013-1fc22f6afc9c
x-project-id: f3d41b77-0cc1-4f0b-b94a-1d5be9c0e3ea
x-user-id: 0fbb231484614b1a80131fc22f6afc9c
x-project-id: f3d41b770cc14f0bb94a1d5be9c0e3ea
content-type: application/json
response_json_paths:
$.`len`: 7
@@ -274,8 +274,8 @@ tests:
url: /v1/resource/generic/1e3d5702-2cbf-46e0-ba13-0ddaa3c71150
method: patch
request_headers:
x-user-id: 0fbb2314-8461-4b1a-8013-1fc22f6afc9c
x-project-id: f3d41b77-0cc1-4f0b-b94a-1d5be9c0e3ea
x-user-id: 0fbb231484614b1a80131fc22f6afc9c
x-project-id: f3d41b770cc14f0bb94a1d5be9c0e3ea
content-type: application/json
data:
ended_at: "2014-01-30T02:02:02.000000"
@@ -284,8 +284,8 @@ tests:
url: /v1/resource/generic/1e3d5702-2cbf-46e0-ba13-0ddaa3c71150
method: patch
request_headers:
x-user-id: 0fbb2314-8461-4b1a-8013-1fc22f6afc9c
x-project-id: f3d41b77-0cc1-4f0b-b94a-1d5be9c0e3ea
x-user-id: 0fbb231484614b1a80131fc22f6afc9c
x-project-id: f3d41b770cc14f0bb94a1d5be9c0e3ea
content-type: application/json
data:
ended_at: "2014-01-31T02:02:02.000000"
@@ -294,8 +294,8 @@ tests:
url: /v1/resource/generic?history=true&sort=id:asc&sort=ended_at:desc-nullslast
method: get
request_headers:
x-user-id: 0fbb2314-8461-4b1a-8013-1fc22f6afc9c
x-project-id: f3d41b77-0cc1-4f0b-b94a-1d5be9c0e3ea
x-user-id: 0fbb231484614b1a80131fc22f6afc9c
x-project-id: f3d41b770cc14f0bb94a1d5be9c0e3ea
content-type: application/json
response_json_paths:
$.`len`: 7

View File

@@ -111,63 +111,63 @@ tests:
method: post
request_headers:
# Only provide one of these auth headers
x-user-id: 0fbb2314-8461-4b1a-8013-1fc22f6afc9c
x-user-id: 0fbb231484614b1a80131fc22f6afc9c
content-type: application/json
data:
id: f93454f2-d8a5-4d67-9985-02511241e7f3
started_at: "2014-01-03T02:02:02.000000"
user_id: 0fbb2314-8461-4b1a-8013-1fc22f6afc9c
project_id: f3d41b77-0cc1-4f0b-b94a-1d5be9c0e3ea
user_id: 0fbb231484614b1a80131fc22f6afc9c
project_id: f3d41b770cc14f0bb94a1d5be9c0e3ea
status: 201
- name: post generic resource
url: /v1/resource/generic
method: post
request_headers:
x-user-id: 0fbb2314-8461-4b1a-8013-1fc22f6afc9c
x-project-id: f3d41b77-0cc1-4f0b-b94a-1d5be9c0e3ea
x-user-id: 0fbb231484614b1a80131fc22f6afc9c
x-project-id: f3d41b770cc14f0bb94a1d5be9c0e3ea
content-type: application/json
data:
id: f93450f2-d8a5-4d67-9985-02511241e7d1
started_at: "2014-01-03T02:02:02.000000"
user_id: 0fbb2314-8461-4b1a-8013-1fc22f6afc9c
project_id: f3d41b77-0cc1-4f0b-b94a-1d5be9c0e3ea
user_id: 0fbb231484614b1a80131fc22f6afc9c
project_id: f3d41b770cc14f0bb94a1d5be9c0e3ea
status: 201
response_headers:
location: $SCHEME://$NETLOC/v1/resource/generic/f93450f2-d8a5-4d67-9985-02511241e7d1
content-type: application/json; charset=UTF-8
response_json_paths:
$.created_by_project_id: f3d41b77-0cc1-4f0b-b94a-1d5be9c0e3ea
$.created_by_user_id: 0fbb2314-8461-4b1a-8013-1fc22f6afc9c
$.user_id: 0fbb2314-8461-4b1a-8013-1fc22f6afc9c
$.created_by_project_id: f3d41b770cc14f0bb94a1d5be9c0e3ea
$.created_by_user_id: 0fbb231484614b1a80131fc22f6afc9c
$.user_id: 0fbb231484614b1a80131fc22f6afc9c
- name: post same resource refuse
desc: We can only post one identified resource once
url: /v1/resource/generic
method: post
request_headers:
x-user-id: 0fbb2314-8461-4b1a-8013-1fc22f6afc9c
x-project-id: f3d41b77-0cc1-4f0b-b94a-1d5be9c0e3ea
x-user-id: 0fbb231484614b1a80131fc22f6afc9c
x-project-id: f3d41b770cc14f0bb94a1d5be9c0e3ea
content-type: application/json
data:
id: f93450f2-d8a5-4d67-9985-02511241e7d1
started_at: "2014-01-03T02:02:02.000000"
user_id: 0fbb2314-8461-4b1a-8013-1fc22f6afc9c
project_id: f3d41b77-0cc1-4f0b-b94a-1d5be9c0e3ea
user_id: 0fbb231484614b1a80131fc22f6afc9c
project_id: f3d41b770cc14f0bb94a1d5be9c0e3ea
status: 409
- name: post generic resource bad content type
url: /v1/resource/generic
method: post
request_headers:
x-user-id: 0fbb2314-8461-4b1a-8013-1fc22f6afc9c
x-project-id: f3d41b77-0cc1-4f0b-b94a-1d5be9c0e3ea
x-user-id: 0fbb231484614b1a80131fc22f6afc9c
x-project-id: f3d41b770cc14f0bb94a1d5be9c0e3ea
content-type: text/plain
data:
id: f93450f2-d8a5-4d67-9985-02511241e7d1
started_at: "2014-01-03T02:02:02.000000"
user_id: 0fbb2314-8461-4b1a-8013-1fc22f6afc9c
project_id: f3d41b77-0cc1-4f0b-b94a-1d5be9c0e3ea
user_id: 0fbb231484614b1a80131fc22f6afc9c
project_id: f3d41b770cc14f0bb94a1d5be9c0e3ea
status: 415
# Create a new instance resource, demonstrate that including no data
@@ -177,8 +177,8 @@ tests:
url: /v1/resource/instance
method: post
request_headers:
x-user-id: 0fbb2314-8461-4b1a-8013-1fc22f6afc9c
x-project-id: f3d41b77-0cc1-4f0b-b94a-1d5be9c0e3ea
x-user-id: 0fbb231484614b1a80131fc22f6afc9c
x-project-id: f3d41b770cc14f0bb94a1d5be9c0e3ea
content-type: application/json
status: 400
@@ -186,13 +186,13 @@ tests:
url: /v1/resource/instance
method: post
request_headers:
x-user-id: 0fbb2314-8461-4b1a-8013-1fc22f6afc9c
x-project-id: f3d41b77-0cc1-4f0b-b94a-1d5be9c0e3ea
x-user-id: 0fbb231484614b1a80131fc22f6afc9c
x-project-id: f3d41b770cc14f0bb94a1d5be9c0e3ea
content-type: application/json
data:
id: 75C44741-CC60-4033-804E-2D3098C7D2E9
user_id: 0fbb2314-8461-4b1a-8013-1fc22f6afc9c
project_id: f3d41b77-0cc1-4f0b-b94a-1d5be9c0e3ea
user_id: 0fbb231484614b1a80131fc22f6afc9c
project_id: f3d41b770cc14f0bb94a1d5be9c0e3ea
flavor_id: "2"
image_ref: http://image
host: compute1
@@ -208,8 +208,8 @@ tests:
url: $LOCATION
method: patch
request_headers:
x-user-id: 0fbb2314-8461-4b1a-8013-1fc22f6afc9c
x-project-id: f3d41b77-0cc1-4f0b-b94a-1d5be9c0e3ea
x-user-id: 0fbb231484614b1a80131fc22f6afc9c
x-project-id: f3d41b770cc14f0bb94a1d5be9c0e3ea
content-type: application/json
data:
host: compute2
@@ -222,8 +222,8 @@ tests:
url: /v1/resource/instance/75C44741-CC60-4033-804E-2D3098C7D2E9
method: patch
request_headers:
x-user-id: 0fbb2314-8461-4b1a-8013-1fc22f6afc9c
x-project-id: f3d41b77-0cc1-4f0b-b94a-1d5be9c0e3ea
x-user-id: 0fbb231484614b1a80131fc22f6afc9c
x-project-id: f3d41b770cc14f0bb94a1d5be9c0e3ea
content-type: application/json
data:
host: compute2
@@ -237,8 +237,8 @@ tests:
url: /v1/resource/instance/75C44741-CC60-4033-804E-2D3098C7D2E9
method: patch
request_headers:
x-user-id: 0fbb2314-8461-4b1a-8013-1fc22f6afc9c
x-project-id: f3d41b77-0cc1-4f0b-b94a-1d5be9c0e3ea
x-user-id: 0fbb231484614b1a80131fc22f6afc9c
x-project-id: f3d41b770cc14f0bb94a1d5be9c0e3ea
content-type: application/json
data:
metrics:
@@ -253,8 +253,8 @@ tests:
url: /v1/resource/instance/75C44741-CC60-4033-804E-2D3098C7D2E9/history?sort=revision_end:asc-nullslast
request_headers:
request_headers:
x-user-id: 0fbb2314-8461-4b1a-8013-1fc22f6afc9c
x-project-id: f3d41b77-0cc1-4f0b-b94a-1d5be9c0e3ea
x-user-id: 0fbb231484614b1a80131fc22f6afc9c
x-project-id: f3d41b770cc14f0bb94a1d5be9c0e3ea
content-type: application/json
response_json_paths:
$.`len`: 2
@@ -267,8 +267,8 @@ tests:
url: /v1/resource/instance/75C44741-CC60-4033-804E-2D3098C7D2E9
method: patch
request_headers:
x-user-id: 0fbb2314-8461-4b1a-8013-1fc22f6afc9c
x-project-id: f3d41b77-0cc1-4f0b-b94a-1d5be9c0e3ea
x-user-id: 0fbb231484614b1a80131fc22f6afc9c
x-project-id: f3d41b770cc14f0bb94a1d5be9c0e3ea
content-type: application/json
data:
metrics:
@@ -281,8 +281,8 @@ tests:
url: /v1/resource/instance/75C44741-CC60-4033-804E-2D3098C7D2E9
method: patch
request_headers:
x-user-id: 0fbb2314-8461-4b1a-8013-1fc22f6afc9c
x-project-id: f3d41b77-0cc1-4f0b-b94a-1d5be9c0e3ea
x-user-id: 0fbb231484614b1a80131fc22f6afc9c
x-project-id: f3d41b770cc14f0bb94a1d5be9c0e3ea
content-type: application/json
data:
metrics:
@@ -296,8 +296,8 @@ tests:
url: /v1/resource/instance/75C44741-CC60-4033-804E-2D3098C7D2E9
method: patch
request_headers:
x-user-id: 0fbb2314-8461-4b1a-8013-1fc22f6afc9c
x-project-id: f3d41b77-0cc1-4f0b-b94a-1d5be9c0e3ea
x-user-id: 0fbb231484614b1a80131fc22f6afc9c
x-project-id: f3d41b770cc14f0bb94a1d5be9c0e3ea
content-type: application/json
data:
metrics:
@@ -310,8 +310,8 @@ tests:
url: /v1/resource/instance/75C44741-CC60-4033-804E-2D3098C7D2E9
method: patch
request_headers:
x-user-id: 0fbb2314-8461-4b1a-8013-1fc22f6afc9c
x-project-id: f3d41b77-0cc1-4f0b-b94a-1d5be9c0e3ea
x-user-id: 0fbb231484614b1a80131fc22f6afc9c
x-project-id: f3d41b770cc14f0bb94a1d5be9c0e3ea
content-type: application/json
data:
metrics:
@@ -322,8 +322,8 @@ tests:
desc: confirm the patched resource is properly patched
url: /v1/resource/instance/75C44741-CC60-4033-804E-2D3098C7D2E9
request_headers:
x-user-id: 0fbb2314-8461-4b1a-8013-1fc22f6afc9c
x-project-id: f3d41b77-0cc1-4f0b-b94a-1d5be9c0e3ea
x-user-id: 0fbb231484614b1a80131fc22f6afc9c
x-project-id: f3d41b770cc14f0bb94a1d5be9c0e3ea
data:
host: compute2
@@ -332,8 +332,8 @@ tests:
url: /v1/resource/instance/75C44741-CC60-4033-804E-2D3098C7D2E9
method: PATCH
request_headers:
x-user-id: 0fbb2314-8461-4b1a-8013-1fc22f6afc9c
x-project-id: f3d41b77-0cc1-4f0b-b94a-1d5be9c0e3ea
x-user-id: 0fbb231484614b1a80131fc22f6afc9c
x-project-id: f3d41b770cc14f0bb94a1d5be9c0e3ea
content-type: application/json
data: "{}"
status: 200
@@ -345,8 +345,8 @@ tests:
url: /v1/resource/instance/75C44741-CC60-4033-804E-2D3098C7D2E9
method: PATCH
request_headers:
x-user-id: 0fbb2314-8461-4b1a-8013-1fc22f6afc9c
x-project-id: f3d41b77-0cc1-4f0b-b94a-1d5be9c0e3ea
x-user-id: 0fbb231484614b1a80131fc22f6afc9c
x-project-id: f3d41b770cc14f0bb94a1d5be9c0e3ea
content-type: application/json
data: "{}"
status: 200
@@ -360,8 +360,8 @@ tests:
url: /v1/resource/instance/75C44741-CC60-4033-804E-2D3098C7D2E9/history
method: POST
request_headers:
x-user-id: 0fbb2314-8461-4b1a-8013-1fc22f6afc9c
x-project-id: f3d41b77-0cc1-4f0b-b94a-1d5be9c0e3ea
x-user-id: 0fbb231484614b1a80131fc22f6afc9c
x-project-id: f3d41b770cc14f0bb94a1d5be9c0e3ea
content-type: application/json
status: 405
@@ -370,8 +370,8 @@ tests:
url: /v1/resource/instance/75C44741-CC60-4033-804E-2D3098C7D2E9/history
method: DELETE
request_headers:
x-user-id: 0fbb2314-8461-4b1a-8013-1fc22f6afc9c
x-project-id: f3d41b77-0cc1-4f0b-b94a-1d5be9c0e3ea
x-user-id: 0fbb231484614b1a80131fc22f6afc9c
x-project-id: f3d41b770cc14f0bb94a1d5be9c0e3ea
content-type: application/json
status: 405
@@ -382,8 +382,8 @@ tests:
url: /v1/resource/instance/75C44741-CC60-4033-804E-2D3098C7D2E9
method: PATCH
request_headers:
x-user-id: 0fbb2314-8461-4b1a-8013-1fc22f6afc9c
x-project-id: f3d41b77-0cc1-4f0b-b94a-1d5be9c0e3ea
x-user-id: 0fbb231484614b1a80131fc22f6afc9c
x-project-id: f3d41b770cc14f0bb94a1d5be9c0e3ea
content-type: application/json
status: 400
response_strings:
@@ -394,8 +394,8 @@ tests:
url: /v1/resource/instance/75C44741-CC60-4033-804E-2D3098C7D2E9
method: PATCH
request_headers:
x-user-id: 0fbb2314-8461-4b1a-8013-1fc22f6afc9c
x-project-id: f3d41b77-0cc1-4f0b-b94a-1d5be9c0e3ea
x-user-id: 0fbb231484614b1a80131fc22f6afc9c
x-project-id: f3d41b770cc14f0bb94a1d5be9c0e3ea
content-type: application/json
status: 400
data:
@@ -408,8 +408,8 @@ tests:
url: /v1/resource/instance/77777777-CC60-4033-804E-2D3098C7D2E9
method: patch
request_headers:
x-user-id: 0fbb2314-8461-4b1a-8013-1fc22f6afc9c
x-project-id: f3d41b77-0cc1-4f0b-b94a-1d5be9c0e3ea
x-user-id: 0fbb231484614b1a80131fc22f6afc9c
x-project-id: f3d41b770cc14f0bb94a1d5be9c0e3ea
content-type: application/json
status: 404
@@ -419,8 +419,8 @@ tests:
desc: if a resource does not exist 404
url: /v1/resource/instance/77777777-CC60-4033-804E-2D3098C7D2E9
request_headers:
x-user-id: 0fbb2314-8461-4b1a-8013-1fc22f6afc9c
x-project-id: f3d41b77-0cc1-4f0b-b94a-1d5be9c0e3ea
x-user-id: 0fbb231484614b1a80131fc22f6afc9c
x-project-id: f3d41b770cc14f0bb94a1d5be9c0e3ea
status: 404
response_strings:
- The resource could not be found.
@@ -429,8 +429,8 @@ tests:
desc: https://bugs.launchpad.net/gnocchi/+bug/1425588
url: /v1/resource/instance/noexist
request_headers:
x-user-id: 0fbb2314-8461-4b1a-8013-1fc22f6afc9c
x-project-id: f3d41b77-0cc1-4f0b-b94a-1d5be9c0e3ea
x-user-id: 0fbb231484614b1a80131fc22f6afc9c
x-project-id: f3d41b770cc14f0bb94a1d5be9c0e3ea
status: 404
response_strings:
- The resource could not be found.
@@ -438,8 +438,8 @@ tests:
- name: get metrics for this not-existing resource
url: /v1/resource/instance/77777777-CC60-4033-804E-2D3098C7D2E9/metric/cpu.util
request_headers:
x-user-id: 0fbb2314-8461-4b1a-8013-1fc22f6afc9c
x-project-id: f3d41b77-0cc1-4f0b-b94a-1d5be9c0e3ea
x-user-id: 0fbb231484614b1a80131fc22f6afc9c
x-project-id: f3d41b770cc14f0bb94a1d5be9c0e3ea
content-type: application/json
status: 404
@@ -453,8 +453,8 @@ tests:
- name: list instance resources
url: /v1/resource/instance
request_headers:
x-user-id: 0fbb2314-8461-4b1a-8013-1fc22f6afc9c
x-project-id: f3d41b77-0cc1-4f0b-b94a-1d5be9c0e3ea
x-user-id: 0fbb231484614b1a80131fc22f6afc9c
x-project-id: f3d41b770cc14f0bb94a1d5be9c0e3ea
response_json_paths:
$[0].host: compute2
$[-1].host: compute2
@@ -462,8 +462,8 @@ tests:
- name: list all resources
url: /v1/resource/generic
request_headers:
x-user-id: 0fbb2314-8461-4b1a-8013-1fc22f6afc9c
x-project-id: f3d41b77-0cc1-4f0b-b94a-1d5be9c0e3ea
x-user-id: 0fbb231484614b1a80131fc22f6afc9c
x-project-id: f3d41b770cc14f0bb94a1d5be9c0e3ea
response_strings:
- '"type": "generic"'
@@ -473,13 +473,13 @@ tests:
url: /v1/resource/instance
method: post
request_headers:
x-user-id: 0fbb2314-8461-4b1a-8013-1fc22f6afc9c
x-project-id: f3d41b77-0cc1-4f0b-b94a-1d5be9c0e3ea
x-user-id: 0fbb231484614b1a80131fc22f6afc9c
x-project-id: f3d41b770cc14f0bb94a1d5be9c0e3ea
content-type: application/json
data:
id: 85C44741-CC60-4033-804E-2D3098C7D2E9
user_id: 0fbb2314-8461-4b1a-8013-1fc22f6afc9c
project_id: f3d41b77-0cc1-4f0b-b94a-1d5be9c0e3ea
user_id: 0fbb231484614b1a80131fc22f6afc9c
project_id: f3d41b770cc14f0bb94a1d5be9c0e3ea
flavor_id: "2"
image_ref: http://image
host: compute3
@@ -492,13 +492,13 @@ tests:
url: /v1/resource/instance
method: post
request_headers:
x-user-id: 0fbb2314-8461-4b1a-8013-1fc22f6afc9c
x-project-id: f3d41b77-0cc1-4f0b-b94a-1d5be9c0e3ea
x-user-id: 0fbb231484614b1a80131fc22f6afc9c
x-project-id: f3d41b770cc14f0bb94a1d5be9c0e3ea
content-type: application/json
data:
id: 85C44741-CC60-4033-804E-2D3098C7D2E9
user_id: 0fbb2314-8461-4b1a-8013-1fc22f6afc9c
project_id: f3d41b77-0cc1-4f0b-b94a-1d5be9c0e3ea
user_id: 0fbb231484614b1a80131fc22f6afc9c
project_id: f3d41b770cc14f0bb94a1d5be9c0e3ea
flavor_id: "2"
image_ref: http://image
host: compute3
@@ -512,13 +512,13 @@ tests:
url: /v1/resource/instance
method: post
request_headers:
x-user-id: 0fbb2314-8461-4b1a-8013-1fc22f6afc9c
x-project-id: f3d41b77-0cc1-4f0b-b94a-1d5be9c0e3ea
x-user-id: 0fbb231484614b1a80131fc22f6afc9c
x-project-id: f3d41b770cc14f0bb94a1d5be9c0e3ea
content-type: application/json
data:
id: 85BABE39-F7F7-455A-877B-62C22E11AA40
user_id: 0fbb2314-8461-4b1a-8013-1fc22f6afc9c
project_id: f3d41b77-0cc1-4f0b-b94a-1d5be9c0e3ea
user_id: 0fbb231484614b1a80131fc22f6afc9c
project_id: f3d41b770cc14f0bb94a1d5be9c0e3ea
flavor_id: "2"
image_ref: http://image
host: compute3
@@ -533,13 +533,13 @@ tests:
url: /v1/resource/instance
method: post
request_headers:
x-user-id: 0fbb2314-8461-4b1a-8013-1fc22f6afc9c
x-project-id: f3d41b77-0cc1-4f0b-b94a-1d5be9c0e3ea
x-user-id: 0fbb231484614b1a80131fc22f6afc9c
x-project-id: f3d41b770cc14f0bb94a1d5be9c0e3ea
content-type: application/json
data:
id: 85BABE39-F7F7-455A-877B-62C22E11AA40
user_id: 0fbb2314-8461-4b1a-8013-1fc22f6afc9c
project_id: f3d41b77-0cc1-4f0b-b94a-1d5be9c0e3ea
user_id: 0fbb231484614b1a80131fc22f6afc9c
project_id: f3d41b770cc14f0bb94a1d5be9c0e3ea
flavor_id: "2"
image_ref: http://image
host: compute3
@@ -552,13 +552,13 @@ tests:
url: /v1/resource/instance
method: post
request_headers:
x-user-id: 0fbb2314-8461-4b1a-8013-1fc22f6afc9c
x-project-id: f3d41b77-0cc1-4f0b-b94a-1d5be9c0e3ea
x-user-id: 0fbb231484614b1a80131fc22f6afc9c
x-project-id: f3d41b770cc14f0bb94a1d5be9c0e3ea
content-type: application/json
data:
id: d13982cb-4cce-4f84-a96e-7581be1e599c
user_id: 0fbb2314-8461-4b1a-8013-1fc22f6afc9c
project_id: f3d41b77-0cc1-4f0b-b94a-1d5be9c0e3ea
user_id: 0fbb231484614b1a80131fc22f6afc9c
project_id: f3d41b770cc14f0bb94a1d5be9c0e3ea
flavor_id: "2"
image_ref: http://image
host: compute3
@@ -568,8 +568,8 @@ tests:
archive_policy_name: medium
status: 201
response_json_paths:
created_by_user_id: 0fbb2314-8461-4b1a-8013-1fc22f6afc9c
created_by_project_id: f3d41b77-0cc1-4f0b-b94a-1d5be9c0e3ea
created_by_user_id: 0fbb231484614b1a80131fc22f6afc9c
created_by_project_id: f3d41b770cc14f0bb94a1d5be9c0e3ea
- name: post new instance with metrics and un-normalized user/project id from keystone middleware
url: /v1/resource/instance
@@ -589,16 +589,16 @@ tests:
archive_policy_name: medium
status: 201
response_json_paths:
created_by_user_id: 0fbb2314-8461-4b1a-8013-1fc22f6afc9c
created_by_project_id: f3d41b77-0cc1-4f0b-b94a-1d5be9c0e3ea
created_by_user_id: 0fbb231484614b1a80131fc22f6afc9c
created_by_project_id: f3d41b770cc14f0bb94a1d5be9c0e3ea
- name: get metrics for this resource
desc: with async measure handling this is a null test
url: /v1/resource/instance/$RESPONSE['$.id']/metric/cpu.util/measures
request_headers:
x-user-id: 0fbb2314-8461-4b1a-8013-1fc22f6afc9c
x-project-id: f3d41b77-0cc1-4f0b-b94a-1d5be9c0e3ea
x-user-id: 0fbb231484614b1a80131fc22f6afc9c
x-project-id: f3d41b770cc14f0bb94a1d5be9c0e3ea
content-type: application/json
response_strings:
- "[]"
@@ -608,14 +608,14 @@ tests:
- name: list the instances
url: /v1/resource/instance
request_headers:
x-user-id: 0fbb2314-8461-4b1a-8013-1fc22f6afc9c
x-project-id: f3d41b77-0cc1-4f0b-b94a-1d5be9c0e3ea
x-user-id: 0fbb231484614b1a80131fc22f6afc9c
x-project-id: f3d41b770cc14f0bb94a1d5be9c0e3ea
- name: request metrics from one of the instances
url: /v1/resource/instance/$RESPONSE['$[-1].id']/metric
request_headers:
x-user-id: 0fbb2314-8461-4b1a-8013-1fc22f6afc9c
x-project-id: f3d41b77-0cc1-4f0b-b94a-1d5be9c0e3ea
x-user-id: 0fbb231484614b1a80131fc22f6afc9c
x-project-id: f3d41b770cc14f0bb94a1d5be9c0e3ea
response_json_paths:
$.`len`: 1
$[0].name: cpu.util
@@ -625,26 +625,26 @@ tests:
desc: 404 from GenericResourceController
url: /v1/resource/instance/not.a.uuid/metric
request_headers:
x-user-id: 0fbb2314-8461-4b1a-8013-1fc22f6afc9c
x-project-id: f3d41b77-0cc1-4f0b-b94a-1d5be9c0e3ea
x-user-id: 0fbb231484614b1a80131fc22f6afc9c
x-project-id: f3d41b770cc14f0bb94a1d5be9c0e3ea
content-type: application/json
status: 404
- name: request cpuutil metric from instance
url: /v1/resource/instance/85C44741-CC60-4033-804E-2D3098C7D2E9/metric/cpu.util
request_headers:
x-user-id: 0fbb2314-8461-4b1a-8013-1fc22f6afc9c
x-project-id: f3d41b77-0cc1-4f0b-b94a-1d5be9c0e3ea
x-user-id: 0fbb231484614b1a80131fc22f6afc9c
x-project-id: f3d41b770cc14f0bb94a1d5be9c0e3ea
response_json_paths:
$.created_by_project_id: f3d41b77-0cc1-4f0b-b94a-1d5be9c0e3ea
$.created_by_project_id: f3d41b770cc14f0bb94a1d5be9c0e3ea
$.archive_policy.name: medium
- name: try post cpuutil metric to instance
url: /v1/resource/instance/85C44741-CC60-4033-804E-2D3098C7D2E9/metric/cpu.util
method: post
request_headers:
x-user-id: 0fbb2314-8461-4b1a-8013-1fc22f6afc9c
x-project-id: f3d41b77-0cc1-4f0b-b94a-1d5be9c0e3ea
x-user-id: 0fbb231484614b1a80131fc22f6afc9c
x-project-id: f3d41b770cc14f0bb94a1d5be9c0e3ea
content-type: application/json
status: 405
@@ -652,8 +652,8 @@ tests:
desc: with async measure handling this is a null test
url: /v1/resource/instance/85C44741-CC60-4033-804E-2D3098C7D2E9/metric/cpu.util/measures
request_headers:
x-user-id: 0fbb2314-8461-4b1a-8013-1fc22f6afc9c
x-project-id: f3d41b77-0cc1-4f0b-b94a-1d5be9c0e3ea
x-user-id: 0fbb231484614b1a80131fc22f6afc9c
x-project-id: f3d41b770cc14f0bb94a1d5be9c0e3ea
response_strings:
- "[]"
@@ -661,8 +661,8 @@ tests:
url: /v1/resource/instance/85C44741-CC60-4033-804E-2D3098C7D2E9/metric/cpu.util/measures
method: post
request_headers:
x-user-id: 0fbb2314-8461-4b1a-8013-1fc22f6afc9c
x-project-id: f3d41b77-0cc1-4f0b-b94a-1d5be9c0e3ea
x-user-id: 0fbb231484614b1a80131fc22f6afc9c
x-project-id: f3d41b770cc14f0bb94a1d5be9c0e3ea
content-type: application/json
data:
- timestamp: "2015-03-06T14:33:57"
@@ -674,8 +674,8 @@ tests:
- name: request cpuutil measures again
url: /v1/resource/instance/85C44741-CC60-4033-804E-2D3098C7D2E9/metric/cpu.util/measures
request_headers:
x-user-id: 0fbb2314-8461-4b1a-8013-1fc22f6afc9c
x-project-id: f3d41b77-0cc1-4f0b-b94a-1d5be9c0e3ea
x-user-id: 0fbb231484614b1a80131fc22f6afc9c
x-project-id: f3d41b770cc14f0bb94a1d5be9c0e3ea
poll:
count: 50
delay: .1
@@ -688,8 +688,8 @@ tests:
url: /v1/resource/instance/85C44741-CC60-4033-804E-2D3098C7D2E9/metric
method: post
request_headers:
x-user-id: 0fbb2314-8461-4b1a-8013-1fc22f6afc9c
x-project-id: f3d41b77-0cc1-4f0b-b94a-1d5be9c0e3ea
x-user-id: 0fbb231484614b1a80131fc22f6afc9c
x-project-id: f3d41b770cc14f0bb94a1d5be9c0e3ea
content-type: application/json
status: 204
data:
@@ -701,8 +701,8 @@ tests:
url: /v1/resource/instance/85C44741-CC60-4033-804E-2D3098C7D2E9/metric
method: post
request_headers:
x-user-id: 0fbb2314-8461-4b1a-8013-1fc22f6afc9c
x-project-id: f3d41b77-0cc1-4f0b-b94a-1d5be9c0e3ea
x-user-id: 0fbb231484614b1a80131fc22f6afc9c
x-project-id: f3d41b770cc14f0bb94a1d5be9c0e3ea
content-type: application/json
status: 400
data:
@@ -714,8 +714,8 @@ tests:
url: /v1/resource/instance/85C44741-CC60-4033-804E-2D3098C7D2E9/metric
method: post
request_headers:
x-user-id: 0fbb2314-8461-4b1a-8013-1fc22f6afc9c
x-project-id: f3d41b77-0cc1-4f0b-b94a-1d5be9c0e3ea
x-user-id: 0fbb231484614b1a80131fc22f6afc9c
x-project-id: f3d41b770cc14f0bb94a1d5be9c0e3ea
content-type: application/json
status: 204
data:
@@ -725,8 +725,8 @@ tests:
url: /v1/resource/instance/85C44741-CC60-4033-804E-2D3098C7D2E9/metric
method: post
request_headers:
x-user-id: 0fbb2314-8461-4b1a-8013-1fc22f6afc9c
x-project-id: f3d41b77-0cc1-4f0b-b94a-1d5be9c0e3ea
x-user-id: 0fbb231484614b1a80131fc22f6afc9c
x-project-id: f3d41b770cc14f0bb94a1d5be9c0e3ea
content-type: application/json
status: 409
data:
@@ -739,8 +739,8 @@ tests:
url: /v1/resource/instance/85C44741-CC60-4033-804E-2D3098C7D2E9/metric
method: post
request_headers:
x-user-id: 0fbb2314-8461-4b1a-8013-1fc22f6afc9c
x-project-id: f3d41b77-0cc1-4f0b-b94a-1d5be9c0e3ea
x-user-id: 0fbb231484614b1a80131fc22f6afc9c
x-project-id: f3d41b770cc14f0bb94a1d5be9c0e3ea
content-type: application/json
status: 400
data:
@@ -755,13 +755,13 @@ tests:
url: /v1/resource/instance
method: post
request_headers:
x-user-id: 0fbb2314-8461-4b1a-8013-1fc22f6afc9c
x-project-id: f3d41b77-0cc1-4f0b-b94a-1d5be9c0e3ea
x-user-id: 0fbb231484614b1a80131fc22f6afc9c
x-project-id: f3d41b770cc14f0bb94a1d5be9c0e3ea
content-type: application/json
data:
id: 95C44741-CC60-4033-804E-2D3098C7D2E9
user_id: 0fbb2314-8461-4b1a-8013-1fc22f6afc9c
project_id: f3d41b77-0cc1-4f0b-b94a-1d5be9c0e3ea
user_id: 0fbb231484614b1a80131fc22f6afc9c
project_id: f3d41b770cc14f0bb94a1d5be9c0e3ea
flavor_id: "2"
image_ref: http://image
host: compute3
@@ -782,8 +782,8 @@ tests:
url: /v1/resource/instance/not.a.uuid/metric
method: post
request_headers:
x-user-id: 0fbb2314-8461-4b1a-8013-1fc22f6afc9c
x-project-id: f3d41b77-0cc1-4f0b-b94a-1d5be9c0e3ea
x-user-id: 0fbb231484614b1a80131fc22f6afc9c
x-project-id: f3d41b770cc14f0bb94a1d5be9c0e3ea
content-type: application/json
data:
some.metric:
@@ -795,8 +795,8 @@ tests:
url: /v1/resource/instance/d5a5994e-ee90-11e4-88cf-685b35afa334/metric
method: post
request_headers:
x-user-id: 0fbb2314-8461-4b1a-8013-1fc22f6afc9c
x-project-id: f3d41b77-0cc1-4f0b-b94a-1d5be9c0e3ea
x-user-id: 0fbb231484614b1a80131fc22f6afc9c
x-project-id: f3d41b770cc14f0bb94a1d5be9c0e3ea
content-type: application/json
data:
some.metric:
@@ -810,8 +810,8 @@ tests:
url: /v1/resource/instance/85C44741-CC60-4033-804E-2D3098C7D2E9/metric/unknown/measures
method: post
request_headers:
x-user-id: 0fbb2314-8461-4b1a-8013-1fc22f6afc9c
x-project-id: f3d41b77-0cc1-4f0b-b94a-1d5be9c0e3ea
x-user-id: 0fbb231484614b1a80131fc22f6afc9c
x-project-id: f3d41b770cc14f0bb94a1d5be9c0e3ea
content-type: application/json
data:
- timestamp: "2015-03-06T14:33:57"
@@ -825,15 +825,15 @@ tests:
- name: delete instance
url: /v1/resource/instance/75C44741-CC60-4033-804E-2D3098C7D2E9
request_headers:
x-user-id: 0fbb2314-8461-4b1a-8013-1fc22f6afc9c
x-project-id: f3d41b77-0cc1-4f0b-b94a-1d5be9c0e3ea
x-user-id: 0fbb231484614b1a80131fc22f6afc9c
x-project-id: f3d41b770cc14f0bb94a1d5be9c0e3ea
method: DELETE
status: 204
- name: delete noexist instance
url: /v1/resource/instance/77777777-CC60-4033-804E-2D3098C7D2E9
request_headers:
x-user-id: 0fbb2314-8461-4b1a-8013-1fc22f6afc9c
x-project-id: f3d41b77-0cc1-4f0b-b94a-1d5be9c0e3ea
x-user-id: 0fbb231484614b1a80131fc22f6afc9c
x-project-id: f3d41b770cc14f0bb94a1d5be9c0e3ea
method: DELETE
status: 404

View File

@@ -8,8 +8,8 @@ fixtures:
defaults:
request_headers:
x-user-id: 0fbb2314-8461-4b1a-8013-1fc22f6afc9c
x-project-id: f3d41b77-0cc1-4f0b-b94a-1d5be9c0e3ea
x-user-id: 0fbb231484614b1a80131fc22f6afc9c
x-project-id: f3d41b770cc14f0bb94a1d5be9c0e3ea
content-type: application/json
tests:
@@ -36,15 +36,15 @@ tests:
method: post
data:
id: generic one
user_id: 0fbb2314-8461-4b1a-8013-1fc22f6afc9c
project_id: f3d41b77-0cc1-4f0b-b94a-1d5be9c0e3ea
user_id: 0fbb231484614b1a80131fc22f6afc9c
project_id: f3d41b770cc14f0bb94a1d5be9c0e3ea
metrics:
cpu.util:
archive_policy_name: medium
status: 201
response_json_paths:
created_by_user_id: 0fbb2314-8461-4b1a-8013-1fc22f6afc9c
created_by_project_id: f3d41b77-0cc1-4f0b-b94a-1d5be9c0e3ea
created_by_user_id: 0fbb231484614b1a80131fc22f6afc9c
created_by_project_id: f3d41b770cc14f0bb94a1d5be9c0e3ea
response_headers:
# is a UUID
location: /v1/resource/generic/[a-f0-9-]{36}/
@@ -111,8 +111,8 @@ tests:
method: post
data:
id: four score and seven years ago we the people of the united states of america i have a dream it is the courage to continue that counts four score and seven years ago we the people of the united states of america i have a dream it is the courage to continue that counts four score and seven years ago we the people of the united states of america i have a dream it is the courage to continue that counts
user_id: 0fbb2314-8461-4b1a-8013-1fc22f6afc9c
project_id: f3d41b77-0cc1-4f0b-b94a-1d5be9c0e3ea
user_id: 0fbb231484614b1a80131fc22f6afc9c
project_id: f3d41b770cc14f0bb94a1d5be9c0e3ea
metrics:
cpu.util:
archive_policy_name: medium
@@ -126,8 +126,8 @@ tests:
data:
# 255 char string
id: four score and seven years ago we the people of the united states of america i have a dream it is the courage to continue that counts four score and seven years ago we the people of the united states of america i have a dream it is the courage to continue
user_id: 0fbb2314-8461-4b1a-8013-1fc22f6afc9c
project_id: f3d41b77-0cc1-4f0b-b94a-1d5be9c0e3ea
user_id: 0fbb231484614b1a80131fc22f6afc9c
project_id: f3d41b770cc14f0bb94a1d5be9c0e3ea
metrics:
cpu.util:
archive_policy_name: medium

View File

@@ -62,8 +62,8 @@ class TestIndexerDriver(tests_base.TestCase):
self.index.delete_archive_policy,
str(uuid.uuid4()))
metric_id = uuid.uuid4()
self.index.create_metric(metric_id, uuid.uuid4(),
uuid.uuid4(), "low")
self.index.create_metric(metric_id, str(uuid.uuid4()),
str(uuid.uuid4()), "low")
self.assertRaises(indexer.ArchivePolicyInUse,
self.index.delete_archive_policy,
"low")
@@ -84,8 +84,8 @@ class TestIndexerDriver(tests_base.TestCase):
def test_create_metric(self):
r1 = uuid.uuid4()
user = uuid.uuid4()
project = uuid.uuid4()
user = str(uuid.uuid4())
project = str(uuid.uuid4())
m = self.index.create_metric(r1, user, project, "low")
self.assertEqual(r1, m.id)
self.assertEqual(m.created_by_user_id, user)
@@ -97,8 +97,8 @@ class TestIndexerDriver(tests_base.TestCase):
def test_expunge_metric(self):
r1 = uuid.uuid4()
user = uuid.uuid4()
project = uuid.uuid4()
user = str(uuid.uuid4())
project = str(uuid.uuid4())
m = self.index.create_metric(r1, user, project, "low")
self.index.delete_metric(m.id)
try:
@@ -117,8 +117,8 @@ class TestIndexerDriver(tests_base.TestCase):
def test_create_resource(self):
r1 = uuid.uuid4()
user = uuid.uuid4()
project = uuid.uuid4()
user = str(uuid.uuid4())
project = str(uuid.uuid4())
rc = self.index.create_resource('generic', r1, user, project)
self.assertIsNotNone(rc.started_at)
self.assertIsNotNone(rc.revision_start)
@@ -142,7 +142,7 @@ class TestIndexerDriver(tests_base.TestCase):
e = uuid.uuid4()
try:
self.index.create_resource(
'generic', uuid.uuid4(), uuid.uuid4(), uuid.uuid4(),
'generic', uuid.uuid4(), str(uuid.uuid4()), str(uuid.uuid4()),
metrics={"foo": e})
except indexer.NoSuchMetric as ex:
self.assertEqual(e, ex.metric)
@@ -151,8 +151,8 @@ class TestIndexerDriver(tests_base.TestCase):
def test_create_resource_already_exists(self):
r1 = uuid.uuid4()
user = uuid.uuid4()
project = uuid.uuid4()
user = str(uuid.uuid4())
project = str(uuid.uuid4())
self.index.create_resource('generic', r1, user, project)
self.assertRaises(indexer.ResourceAlreadyExists,
self.index.create_resource,
@@ -160,8 +160,8 @@ class TestIndexerDriver(tests_base.TestCase):
def test_create_resource_with_new_metrics(self):
r1 = uuid.uuid4()
user = uuid.uuid4()
project = uuid.uuid4()
user = str(uuid.uuid4())
project = str(uuid.uuid4())
rc = self.index.create_resource(
'generic', r1, user, project,
metrics={"foobar": {"archive_policy_name": "low"}})
@@ -171,8 +171,8 @@ class TestIndexerDriver(tests_base.TestCase):
def _do_test_create_instance(self, server_group=None, image_ref=None):
r1 = uuid.uuid4()
user = uuid.uuid4()
project = uuid.uuid4()
user = str(uuid.uuid4())
project = str(uuid.uuid4())
kwargs = {'server_group': server_group} if server_group else {}
rc = self.index.create_resource('instance', r1, user, project,
@@ -216,15 +216,16 @@ class TestIndexerDriver(tests_base.TestCase):
def test_delete_resource(self):
r1 = uuid.uuid4()
self.index.create_resource('generic', r1, uuid.uuid4(), uuid.uuid4())
self.index.create_resource('generic', r1, str(uuid.uuid4()),
str(uuid.uuid4()))
self.index.delete_resource(r1)
self.assertRaises(indexer.NoSuchResource,
self.index.delete_resource,
r1)
def test_delete_resource_with_metrics(self):
user = uuid.uuid4()
project = uuid.uuid4()
user = str(uuid.uuid4())
project = str(uuid.uuid4())
e1 = uuid.uuid4()
e2 = uuid.uuid4()
self.index.create_metric(e1, user, project,
@@ -250,8 +251,8 @@ class TestIndexerDriver(tests_base.TestCase):
def test_create_resource_with_start_timestamp(self):
r1 = uuid.uuid4()
ts = utils.datetime_utc(2014, 1, 1, 23, 34, 23, 1234)
user = uuid.uuid4()
project = uuid.uuid4()
user = str(uuid.uuid4())
project = str(uuid.uuid4())
rc = self.index.create_resource(
'generic',
r1, user, project,
@@ -274,8 +275,8 @@ class TestIndexerDriver(tests_base.TestCase):
r1 = uuid.uuid4()
e1 = uuid.uuid4()
e2 = uuid.uuid4()
user = uuid.uuid4()
project = uuid.uuid4()
user = str(uuid.uuid4())
project = str(uuid.uuid4())
self.index.create_metric(e1,
user, project,
archive_policy_name="low")
@@ -324,8 +325,8 @@ class TestIndexerDriver(tests_base.TestCase):
def test_update_resource_end_timestamp(self):
r1 = uuid.uuid4()
user = uuid.uuid4()
project = uuid.uuid4()
user = str(uuid.uuid4())
project = str(uuid.uuid4())
self.index.create_resource('generic', r1, user, project)
self.index.update_resource(
'generic',
@@ -366,8 +367,8 @@ class TestIndexerDriver(tests_base.TestCase):
r1 = uuid.uuid4()
e1 = uuid.uuid4()
e2 = uuid.uuid4()
user = uuid.uuid4()
project = uuid.uuid4()
user = str(uuid.uuid4())
project = str(uuid.uuid4())
self.index.create_metric(e1, user, project,
archive_policy_name="low")
self.index.create_resource('generic', r1, user, project,
@@ -382,8 +383,8 @@ class TestIndexerDriver(tests_base.TestCase):
r1 = uuid.uuid4()
e1 = uuid.uuid4()
e2 = uuid.uuid4()
user = uuid.uuid4()
project = uuid.uuid4()
user = str(uuid.uuid4())
project = str(uuid.uuid4())
self.index.create_metric(e1, user, project,
archive_policy_name="low")
self.index.create_metric(e2, user, project,
@@ -402,8 +403,8 @@ class TestIndexerDriver(tests_base.TestCase):
r1 = uuid.uuid4()
e1 = uuid.uuid4()
e2 = uuid.uuid4()
user = uuid.uuid4()
project = uuid.uuid4()
user = str(uuid.uuid4())
project = str(uuid.uuid4())
self.index.create_metric(e1, user, project,
archive_policy_name="low")
self.index.create_metric(e2, user, project,
@@ -420,8 +421,8 @@ class TestIndexerDriver(tests_base.TestCase):
def test_update_resource_attribute(self):
r1 = uuid.uuid4()
user = uuid.uuid4()
project = uuid.uuid4()
user = str(uuid.uuid4())
project = str(uuid.uuid4())
rc = self.index.create_resource('instance', r1, user, project,
flavor_id="1",
image_ref="http://foo/bar",
@@ -433,8 +434,8 @@ class TestIndexerDriver(tests_base.TestCase):
def test_update_resource_no_change(self):
r1 = uuid.uuid4()
user = uuid.uuid4()
project = uuid.uuid4()
user = str(uuid.uuid4())
project = str(uuid.uuid4())
rc = self.index.create_resource('instance', r1, user, project,
flavor_id="1",
image_ref="http://foo/bar",
@@ -451,8 +452,8 @@ class TestIndexerDriver(tests_base.TestCase):
def test_update_resource_ended_at_fail(self):
r1 = uuid.uuid4()
user = uuid.uuid4()
project = uuid.uuid4()
user = str(uuid.uuid4())
project = str(uuid.uuid4())
self.index.create_resource('instance', r1, user, project,
flavor_id="1",
image_ref="http://foo/bar",
@@ -466,7 +467,8 @@ class TestIndexerDriver(tests_base.TestCase):
def test_update_resource_unknown_attribute(self):
r1 = uuid.uuid4()
self.index.create_resource('instance', r1, uuid.uuid4(), uuid.uuid4(),
self.index.create_resource('instance', r1, str(uuid.uuid4()),
str(uuid.uuid4()),
flavor_id="1",
image_ref="http://foo/bar",
host="foo",
@@ -479,7 +481,8 @@ class TestIndexerDriver(tests_base.TestCase):
def test_update_non_existent_metric(self):
r1 = uuid.uuid4()
e1 = uuid.uuid4()
self.index.create_resource('generic', r1, uuid.uuid4(), uuid.uuid4())
self.index.create_resource('generic', r1, str(uuid.uuid4()),
str(uuid.uuid4()))
self.assertRaises(indexer.NoSuchMetric,
self.index.update_resource,
'generic',
@@ -488,7 +491,7 @@ class TestIndexerDriver(tests_base.TestCase):
def test_update_non_existent_resource(self):
r1 = uuid.uuid4()
e1 = uuid.uuid4()
self.index.create_metric(e1, uuid.uuid4(), uuid.uuid4(),
self.index.create_metric(e1, str(uuid.uuid4()), str(uuid.uuid4()),
archive_policy_name="low")
self.assertRaises(indexer.NoSuchResource,
self.index.update_resource,
@@ -501,15 +504,15 @@ class TestIndexerDriver(tests_base.TestCase):
self.assertRaises(indexer.NoSuchMetric,
self.index.create_resource,
'generic',
r1, uuid.uuid4(), uuid.uuid4(),
r1, str(uuid.uuid4()), str(uuid.uuid4()),
metrics={'foo': e1})
def test_delete_metric_on_resource(self):
r1 = uuid.uuid4()
e1 = uuid.uuid4()
e2 = uuid.uuid4()
user = uuid.uuid4()
project = uuid.uuid4()
user = str(uuid.uuid4())
project = str(uuid.uuid4())
self.index.create_metric(e1, user, project,
archive_policy_name="low")
self.index.create_metric(e2, user, project,
@@ -542,7 +545,8 @@ class TestIndexerDriver(tests_base.TestCase):
def test_delete_instance(self):
r1 = uuid.uuid4()
created = self.index.create_resource('instance', r1,
uuid.uuid4(), uuid.uuid4(),
str(uuid.uuid4()),
str(uuid.uuid4()),
flavor_id="123",
image_ref="foo",
host="dwq",
@@ -561,8 +565,8 @@ class TestIndexerDriver(tests_base.TestCase):
def test_list_resources_by_user(self):
r1 = uuid.uuid4()
user = uuid.uuid4()
project = uuid.uuid4()
user = str(uuid.uuid4())
project = str(uuid.uuid4())
g = self.index.create_resource('generic', r1, user, project,
user, project)
resources = self.index.list_resources(
@@ -572,13 +576,13 @@ class TestIndexerDriver(tests_base.TestCase):
self.assertEqual(g, resources[0])
resources = self.index.list_resources(
'generic',
attribute_filter={"=": {"user_id": uuid.uuid4()}})
attribute_filter={"=": {"user_id": 'bad-user'}})
self.assertEqual(0, len(resources))
def test_list_resources_by_created_by_user(self):
r1 = uuid.uuid4()
user = uuid.uuid4()
project = uuid.uuid4()
user = str(uuid.uuid4())
project = str(uuid.uuid4())
g = self.index.create_resource('generic', r1, user, project)
resources = self.index.list_resources(
'generic',
@@ -587,13 +591,13 @@ class TestIndexerDriver(tests_base.TestCase):
self.assertEqual(g, resources[0])
resources = self.index.list_resources(
'generic',
attribute_filter={"=": {"created_by_user_id": uuid.uuid4()}})
attribute_filter={"=": {"created_by_user_id": 'bad-user'}})
self.assertEqual(0, len(resources))
def test_list_resources_by_user_with_details(self):
r1 = uuid.uuid4()
user = uuid.uuid4()
project = uuid.uuid4()
user = str(uuid.uuid4())
project = str(uuid.uuid4())
g = self.index.create_resource('generic', r1, user, project,
user, project)
r2 = uuid.uuid4()
@@ -615,8 +619,8 @@ class TestIndexerDriver(tests_base.TestCase):
def test_list_resources_by_project(self):
r1 = uuid.uuid4()
user = uuid.uuid4()
project = uuid.uuid4()
user = str(uuid.uuid4())
project = str(uuid.uuid4())
g = self.index.create_resource('generic', r1, user, project,
user, project)
resources = self.index.list_resources(
@@ -626,13 +630,13 @@ class TestIndexerDriver(tests_base.TestCase):
self.assertEqual(g, resources[0])
resources = self.index.list_resources(
'generic',
attribute_filter={"=": {"project_id": uuid.uuid4()}})
attribute_filter={"=": {"project_id": 'bad-project'}})
self.assertEqual(0, len(resources))
def test_list_resources_by_duration(self):
r1 = uuid.uuid4()
user = uuid.uuid4()
project = uuid.uuid4()
user = str(uuid.uuid4())
project = str(uuid.uuid4())
g = self.index.create_resource(
'generic', r1, user, project,
user_id=user, project_id=project,
@@ -660,10 +664,10 @@ class TestIndexerDriver(tests_base.TestCase):
# for now it'll be better than nothing.
r1 = uuid.uuid4()
g = self.index.create_resource('generic', r1,
uuid.uuid4(), uuid.uuid4())
str(uuid.uuid4()), str(uuid.uuid4()))
r2 = uuid.uuid4()
i = self.index.create_resource('instance', r2,
uuid.uuid4(), uuid.uuid4(),
str(uuid.uuid4()), str(uuid.uuid4()),
flavor_id="123",
image_ref="foo",
host="dwq",
@@ -712,10 +716,10 @@ class TestIndexerDriver(tests_base.TestCase):
def test_list_resources_without_history(self):
e = uuid.uuid4()
rid = uuid.uuid4()
user = uuid.uuid4()
project = uuid.uuid4()
new_user = uuid.uuid4()
new_project = uuid.uuid4()
user = str(uuid.uuid4())
project = str(uuid.uuid4())
new_user = str(uuid.uuid4())
new_project = str(uuid.uuid4())
self.index.create_metric(e, user, project,
archive_policy_name="low")
@@ -741,10 +745,10 @@ class TestIndexerDriver(tests_base.TestCase):
e1 = uuid.uuid4()
e2 = uuid.uuid4()
rid = uuid.uuid4()
user = uuid.uuid4()
project = uuid.uuid4()
new_user = uuid.uuid4()
new_project = uuid.uuid4()
user = str(uuid.uuid4())
project = str(uuid.uuid4())
new_user = str(uuid.uuid4())
new_project = str(uuid.uuid4())
self.index.create_metric(e1, user, project,
archive_policy_name="low")
@@ -781,10 +785,10 @@ class TestIndexerDriver(tests_base.TestCase):
e1 = uuid.uuid4()
e2 = uuid.uuid4()
rid = uuid.uuid4()
user = uuid.uuid4()
project = uuid.uuid4()
new_user = uuid.uuid4()
new_project = uuid.uuid4()
user = str(uuid.uuid4())
project = str(uuid.uuid4())
new_user = str(uuid.uuid4())
new_project = str(uuid.uuid4())
self.index.create_metric(e1, user, project,
archive_policy_name="low")
@@ -828,8 +832,8 @@ class TestIndexerDriver(tests_base.TestCase):
# database for all tests and the tests are running concurrently, but
# for now it'll be better than nothing.
r1 = uuid.uuid4()
user = uuid.uuid4()
project = uuid.uuid4()
user = str(uuid.uuid4())
project = str(uuid.uuid4())
g = self.index.create_resource(
'generic', r1, user, project,
started_at=utils.datetime_utc(2000, 1, 1, 23, 23, 23),
@@ -891,8 +895,8 @@ class TestIndexerDriver(tests_base.TestCase):
def test_get_metric(self):
e1 = uuid.uuid4()
user = uuid.uuid4()
project = uuid.uuid4()
user = str(uuid.uuid4())
project = str(uuid.uuid4())
self.index.create_metric(e1,
user, project,
archive_policy_name="low")
@@ -908,8 +912,8 @@ class TestIndexerDriver(tests_base.TestCase):
def test_get_metric_with_details(self):
e1 = uuid.uuid4()
user = uuid.uuid4()
project = uuid.uuid4()
user = str(uuid.uuid4())
project = str(uuid.uuid4())
self.index.create_metric(e1,
user, project,
archive_policy_name="low")
@@ -936,8 +940,8 @@ class TestIndexerDriver(tests_base.TestCase):
def test_list_metrics(self):
e1 = uuid.uuid4()
user = uuid.uuid4()
project = uuid.uuid4()
user = str(uuid.uuid4())
project = str(uuid.uuid4())
self.index.create_metric(e1,
user, project,
archive_policy_name="low")
@@ -956,8 +960,8 @@ class TestIndexerDriver(tests_base.TestCase):
def test_list_metrics_delete_status(self):
e1 = uuid.uuid4()
user = uuid.uuid4()
project = uuid.uuid4()
user = str(uuid.uuid4())
project = str(uuid.uuid4())
self.index.create_metric(e1,
user, project,
archive_policy_name="low")

View File

@@ -1860,10 +1860,8 @@ class GenericResourceTest(RestTest):
params={
"id": resource_id,
"started_at": "2014-01-01 02:02:02",
# We replace "-" to simulate a middleware that would send UUID
# in a non normalized format.
"user_id": TestingApp.USER_ID_2.replace("-", ""),
"project_id": TestingApp.PROJECT_ID_2.replace("-", ""),
"user_id": TestingApp.USER_ID_2,
"project_id": TestingApp.PROJECT_ID_2,
"metrics": {"foobar": {"archive_policy_name": "low"}},
})

View File

@@ -27,8 +27,8 @@ from gnocchi import utils
class TestStatsd(tests_base.TestCase):
STATSD_USER_ID = uuid.uuid4()
STATSD_PROJECT_ID = uuid.uuid4()
STATSD_USER_ID = str(uuid.uuid4())
STATSD_PROJECT_ID = str(uuid.uuid4())
STATSD_ARCHIVE_POLICY_NAME = "medium"
def setUp(self):