This repository has been archived by the owner on Apr 27, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 54
Client Library HIL | query calls #617
Merged
Merged
Changes from 1 commit
Commits
Show all changes
84 commits
Select commit
Hold shift + click to select a range
e75786c
client library support for HIL query calls.
SahilTikale 61bb87d
Adds files containing common code to build client library.
SahilTikale 3d8ca6d
Merge branch 'master' into HILclientlib-querycalls
SahilTikale ee5aa40
Adds client library support for query calls
SahilTikale 529b37c
Adds client support to CLI.
SahilTikale e5cdad3
Adds
SahilTikale 060a55e
Adds unit tests and some code refactor.
SahilTikale 5237d61
Addresses unit tests of client Base class
SahilTikale dc4ffea
Merge branch 'master' into HILclientlib-querycalls
SahilTikale cae9dd4
Supports new call list_nodes in place of list_free_nodes.
SahilTikale 06b197a
adds __init__ file
SahilTikale f9eb580
making unit tests to work
SahilTikale 2e63285
Includes a clean way to
SahilTikale f36ac1f
unit tests pass.
SahilTikale ddf43d4
Merge remote-tracking branch 'origin/master' into HILclientlib-queryc…
SahilTikale 595c30d
Fixes unit tests
SahilTikale b0106ac
increasing delay to fix tests
SahilTikale 27a619f
fixes CI test
SahilTikale e04d629
fixing CI tests
SahilTikale ae7c278
Merge remote-tracking branch 'origin/master' into HILclientlib-queryc…
SahilTikale 7cddc95
Fixes call list_nodes in the client library. Had the same issue as fi…
SahilTikale ef94c61
Adding add/delete operations and tests related to project
SahilTikale e5f3150
Adding network module to client library
SahilTikale c07cc78
Adds client library support and unit tests for
SahilTikale 16de104
Adds node operations.
SahilTikale 404a37b
Adds
SahilTikale c3d54bf
syncing with upstream master
SahilTikale 16bb93c
This commit makes the necessary changes to support keystone as a backend
SahilTikale da671fc
Removes old client Library
SahilTikale 2e164cd
Fixes some broken tests. Makes tests/unit/client.py pep8 complaint.
SahilTikale e132ea6
1st pass at Integrating keystone authentication with client library.
SahilTikale 485ced3
Adds user operations related calls in client library and cli.
SahilTikale b9ffe29
Adds client library calls for network, node and cli support for them.
SahilTikale ba23ded
Adds calls node connect network and switch related calls.
SahilTikale 174cec7
minor changes
SahilTikale 347090c
Adds client library calls for most of the api calls
SahilTikale bcbcd12
Fixes console calls in node.py and adds unit tests
SahilTikale 37cf4b0
adds more unit tests
SahilTikale 4d50af5
Merge branch 'master' into HILclientlib-querycalls
SahilTikale 21f9d13
addresses @zenhacks comments
SahilTikale 559bc40
fixed failing test
naved001 d65ed0f
fixed pep8 errors in all files except test/unit/client.py
meng-sun 16bbefd
Merge remote-tracking branch 'upstream/HILclientlib-querycalls' into …
meng-sun bac7d39
pep8 issues fixed
gfaline 5c29a76
Merge pull request #2 from meng-sun/HILclientlib-querycalls
gfaline 98967cd
fixed a couple more pep8 errors
gfaline 0556f3d
fixed pep8 issues
gfaline 14cedef
Merge pull request #1 from naved001/HILclientlib-querycalls
henn 7b6523e
type error fix that aligns with pep8 fix
meng-sun 7fe634d
assertionError problems fixed
meng-sun 0213717
Merge pull request #3 from meng-sun/HILclientlib-querycalls
meng-sun d1c9eba
Merge pull request #4 from naved001/naved/sahil
SahilTikale e22c210
Addresses comments from reviewers.
SahilTikale 5e30397
fixing pep8 issues
SahilTikale b45ec80
Includes code refactored to reduce verbosity as recommended by @zenhack
SahilTikale d20c55f
removing non-essential code
SahilTikale adc94d0
removes import that is not required anymore
SahilTikale 493ae42
Merge remote-tracking branch 'origin/master' into HILclientlib-queryc…
SahilTikale 290e150
Refactors cli.py to reduce repetitive code
SahilTikale a54ce5e
Fixes the broken test due to recent merging with the master
SahilTikale b1b3e97
Fixes the broken test due to recent merging with the master
SahilTikale de9ddeb
Refactors client library code to reduce code verbosity.
SahilTikale d266f4d
Minor refactoring. moving to only for methods.
SahilTikale a8a0a71
Fixes tests
SahilTikale df915fd
Updates setup.py to install dependencies to support keystone.
SahilTikale e05786f
Makes changes suggested by @zenhack.
SahilTikale 3b1ece8
Fixes doc string and other minor changes
SahilTikale 8a33ed0
Merge branch 'master' into HILclientlib-querycalls
SahilTikale 6a8b932
Changes client library to accept a complete object
SahilTikale 42bd4dd
Fixes failing tests,
SahilTikale c7195a1
minor changes
SahilTikale 67ba238
Fixes cli integration test, Puts appropriate comments in cli.py
SahilTikale f48e608
minor changes, moving text from docstring to comment
SahilTikale 696f3ef
fixes integration tests
SahilTikale 5786e37
Addresses all the changes recommended by reviewers.
SahilTikale b01e176
improves tests, removes redundant code
SahilTikale cca1c99
fixes a tedious test.
SahilTikale d6e0247
Updated with comment and increased time to avoid a potential race con…
SahilTikale 82a9044
solves the race condition for network tests.
SahilTikale a1ff5b4
uses sqlalchemy to query networkingaction, to avoid race condition in…
SahilTikale 1cd832e
refactors . Addresses other suggestions by reviewers.
SahilTikale 22800ab
Improves tests, provides explicit message for time out. Moves imports…
SahilTikale 157e518
minorly improves
SahilTikale 922437f
Catches error of not setting HAAS_ENDPOINT.
SahilTikale File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -28,10 +28,12 @@ | |
from urlparse import urljoin | ||
import requests | ||
from requests.exceptions import ConnectionError | ||
from flask.ext.sqlalchemy import SQLAlchemy | ||
from haas.flaskapp import app | ||
from haas.model import NetworkingAction | ||
from haas.client.base import ClientBase, FailedAPICallException | ||
from haas.client.client import Client, RequestsHTTPClient, KeystoneHTTPClient | ||
|
||
|
||
ep = "http://127.0.0.1:8000" or os.environ.get('HAAS_ENDPOINT') | ||
username = "hil_user" or os.environ.get('HAAS_USERNAME') | ||
password = "hil_pass1234" or os.environ.get('HAAS_PASSWORD') | ||
|
@@ -71,7 +73,7 @@ def test_object_url(self): | |
def make_config(): | ||
""" This function creates haas.cfg with desired options | ||
and writes to a temporary directory. | ||
It returns a tuple where (tmpdir, cwd) = ('location of haas.cfg', 'pwdd') | ||
It returns a tuple where (tmpdir, cwd) = ('location of haas.cfg', 'pwd') | ||
""" | ||
tmpdir = tempfile.mkdtemp() | ||
global db_dir | ||
|
@@ -248,21 +250,18 @@ def avoid_network_race_condition(): | |
Used to avoid race condition between subsequent network calls | ||
on the same object. | ||
""" | ||
|
||
from flask.ext.sqlalchemy import SQLAlchemy | ||
from haas.flaskapp import app | ||
from haas.model import Node, Project, NetworkingAction | ||
|
||
global db_dir | ||
uri = 'sqlite:///'+db_dir+'/haas.db' | ||
db = SQLAlchemy(app) | ||
app.config.update(SQLALCHEMY_DATABASE_URI=uri) | ||
|
||
for timeout in range(10): | ||
if (db.session.query(NetworkingAction).count() > 0): | ||
que = db.session.query(NetworkingAction).count() | ||
if (que > 0): | ||
time.sleep(1) | ||
else: | ||
break | ||
return que | ||
return timeout | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I would just raise an exception here (of a newly-declared type, which denotes a timeout), and get rid of the if/else checks elsewhere. |
||
|
||
|
||
@pytest.fixture(scope="module") | ||
|
@@ -355,15 +354,21 @@ def test_node_connect_network_error(self): | |
|
||
def test_node_detach_network(self): | ||
C.node.connect_network('node-04', 'eth0', 'net-04', 'vlan/native') | ||
avoid_network_race_condition() | ||
assert C.node.detach_network('node-04', 'eth0', 'net-04') is None | ||
x = avoid_network_race_condition() | ||
if x == 0: | ||
assert C.node.detach_network('node-04', 'eth0', 'net-04') is None | ||
else: | ||
assert False, "Timing out a race condition for networking actions." | ||
|
||
def test_node_detach_network_error(self): | ||
C.node.connect_network('node-04', 'eth0', 'net-04', 'vlan/native') | ||
avoid_network_race_condition() | ||
C.node.detach_network('node-04', 'eth0', 'net-04') | ||
with pytest.raises(FailedAPICallException): | ||
x = avoid_network_race_condition() | ||
if x == 0: | ||
C.node.detach_network('node-04', 'eth0', 'net-04') | ||
with pytest.raises(FailedAPICallException): | ||
C.node.detach_network('node-04', 'eth0', 'net-04') | ||
else: | ||
assert False, "Timing out a race condition for networking actions." | ||
|
||
|
||
@pytest.mark.usefixtures("create_setup") | ||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we should still put some upper bound on how long we're willing to wait -- maybe a minute or two. Otherwise travis will run for a very long time without notifying us that anything is wrong. I've had jobs just busy looping for 20 minutes before.
Doing an exponential backoff would be the "standard" approach, but I'm not picky on that point.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
put a time out of 10 sec