Added the actual post request to upload
Change-Id: I4297ec4c44c84c2c7b1fefe5f65eac55e5a6845e
This commit is contained in:
parent
456b885255
commit
38e6276737
3
.gitignore
vendored
3
.gitignore
vendored
@ -8,3 +8,6 @@ cover/*
|
|||||||
.project
|
.project
|
||||||
.pydevproject
|
.pydevproject
|
||||||
build
|
build
|
||||||
|
.tempest/
|
||||||
|
.venv/
|
||||||
|
|
||||||
|
@ -29,6 +29,7 @@ import ConfigParser
|
|||||||
import json
|
import json
|
||||||
import logging
|
import logging
|
||||||
import os
|
import os
|
||||||
|
import requests
|
||||||
import subprocess
|
import subprocess
|
||||||
import time
|
import time
|
||||||
|
|
||||||
@ -93,7 +94,7 @@ class RefstackClient:
|
|||||||
if not os.path.isfile(self.args.file):
|
if not os.path.isfile(self.args.file):
|
||||||
self.logger.error("File not valid: %s" % self.args.file)
|
self.logger.error("File not valid: %s" % self.args.file)
|
||||||
exit(1)
|
exit(1)
|
||||||
self.logger.setLevel(logging.DEBUG)
|
|
||||||
self.upload_file = self.args.file
|
self.upload_file = self.args.file
|
||||||
|
|
||||||
def _get_next_stream_subunit_output_file(self, tempest_dir):
|
def _get_next_stream_subunit_output_file(self, tempest_dir):
|
||||||
@ -164,11 +165,15 @@ class RefstackClient:
|
|||||||
|
|
||||||
def post_results(self, url, content):
|
def post_results(self, url, content):
|
||||||
'''Post the combined results back to the server.'''
|
'''Post the combined results back to the server.'''
|
||||||
|
self.logger.debug('API request content: %s ' % content)
|
||||||
|
try:
|
||||||
|
url = '%s/v1/results/' % self.args.url
|
||||||
|
|
||||||
# TODO(cdiep): Post results once the API is available as outlined here:
|
response = requests.post(url, data={'data': json.dumps(content)})
|
||||||
# github.com/stackforge/refstack/blob/master/specs/approved/api-v1.md
|
self.logger.info(url + " Response: " + str(response.text))
|
||||||
json_content = json.dumps(content)
|
except Exception as e:
|
||||||
self.logger.debug('API request content: %s ' % json_content)
|
self.logger.critical('Failed to post %s - %s ' % (url, e))
|
||||||
|
raise
|
||||||
|
|
||||||
def test(self):
|
def test(self):
|
||||||
'''Execute Tempest test against the cloud.'''
|
'''Execute Tempest test against the cloud.'''
|
||||||
|
Loading…
x
Reference in New Issue
Block a user