tests: do not create a archive policy on setup
Change-Id: Ic4329ff1ebbd3a1cad9b5d97aeb011d848a94f2c
This commit is contained in:
parent
694a9dfadf
commit
44835361f3
|
@ -9,17 +9,24 @@
|
|||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
import uuid
|
||||
|
||||
from gnocchiclient.tests.functional import base
|
||||
|
||||
|
||||
class ArchivePolicyRuleClientTest(base.ClientTestBase):
|
||||
def test_archive_policy_rule_scenario(self):
|
||||
apname = str(uuid.uuid4())
|
||||
# Create an archive policy
|
||||
self.gnocchi(
|
||||
u'archive-policy', params=u"create %s"
|
||||
u" -d granularity:1s,points:86400" % apname)
|
||||
|
||||
# CREATE
|
||||
result = self.gnocchi(
|
||||
u'archive-policy-rule', params=u"create test"
|
||||
u" --archive-policy high"
|
||||
u" --metric-pattern 'disk.io.*'")
|
||||
u" --archive-policy %s"
|
||||
u" --metric-pattern 'disk.io.*'" % apname)
|
||||
policy_rule = self.details_multiple(result)[0]
|
||||
self.assertEqual('test', policy_rule["name"])
|
||||
|
||||
|
|
|
@ -21,6 +21,12 @@ class ResourceClientTest(base.ClientTestBase):
|
|||
PROJECT_ID = str(uuid.uuid4())
|
||||
|
||||
def test_resource_scenario(self):
|
||||
apname = str(uuid.uuid4())
|
||||
# Create an archive policy
|
||||
self.gnocchi(
|
||||
u'archive-policy', params=u"create %s"
|
||||
u" -d granularity:1s,points:86400" % apname)
|
||||
|
||||
# CREATE
|
||||
result = self.gnocchi(
|
||||
u'resource', params=u"create %s --type generic" %
|
||||
|
@ -34,8 +40,8 @@ class ResourceClientTest(base.ClientTestBase):
|
|||
# UPDATE
|
||||
result = self.gnocchi(
|
||||
'resource', params=("update -t generic %s -a project_id:%s "
|
||||
"-n temperature:high" %
|
||||
(self.RESOURCE_ID, self.PROJECT_ID)))
|
||||
"-n temperature:%s" %
|
||||
(self.RESOURCE_ID, self.PROJECT_ID, apname)))
|
||||
resource_updated = self.details_multiple(result)[0]
|
||||
self.assertEqual(self.RESOURCE_ID, resource_updated["id"])
|
||||
self.assertEqual(self.PROJECT_ID, resource_updated["project_id"])
|
||||
|
|
|
@ -53,7 +53,4 @@ gnocchi-api --config-file ${GNOCCHI_DATA}/gnocchi.conf &> ${GNOCCHI_DATA}/out &
|
|||
wait_for_line "Running on http://0.0.0.0:8041/" ${GNOCCHI_DATA}/out
|
||||
export GNOCCHI_ENDPOINT=http://localhost:8041/
|
||||
|
||||
create_archive_policy() { curl -X POST -H "X-USER-ID: $(uuidgen)" -H "X-PROJECT-ID: $(uuidgen)" -H "Content-Type: application/json" -d "$1" ${GNOCCHI_ENDPOINT}v1/archive_policy ; }
|
||||
create_archive_policy '{"name":"high","definition":[{"granularity": "1s","points": 86400},{"granularity": "1m","points": 43200},{"granularity": "1h","points": 8760}]}'
|
||||
|
||||
$*
|
||||
|
|
Loading…
Reference in New Issue