-
Notifications
You must be signed in to change notification settings - Fork 191
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Updating OQC client to new cloud workflow * updated OQC Client to catch up with the latest QCaaS * clang-format applied * mock server is formatted with yapf --style google -i * pyspelling does not allow qpu and removed the comment line * DCO Remediation Commit for jamie <[email protected]> I, jamie <[email protected]>, hereby add my Signed-off-by to this commit: 7d7c716 Signed-off-by: jamie <[email protected]> * iostream should not be needed Signed-off-by: Noriyuki Kushida <[email protected]> DCO Remediation Commit for Noriyuki Kushida <[email protected]> I, Noriyuki Kushida <[email protected]>, hereby add my Signed-off-by to this commit: d019f7e I, Noriyuki Kushida <[email protected]>, hereby add my Signed-off-by to this commit: f26f908 I, Noriyuki Kushida <[email protected]>, hereby add my Signed-off-by to this commit: 88734a5 Signed-off-by: Noriyuki Kushida <[email protected]> DCO Remediation Commit for root <[email protected]> I, root <[email protected]>, hereby add my Signed-off-by to this commit: b453c84 Signed-off-by: root <[email protected]> * DCO Remediation Commit for root <[email protected]> I, root <[email protected]>, hereby add my Signed-off-by to this commit: b453c84 Signed-off-by: root <[email protected]> Signed-off-by: root <[email protected]> * OQC_URL is given as an environment variable Signed-off-by: Noriyuki Kushida <[email protected]> * format fixed Signed-off-by: Noriyuki Kushida <[email protected]> * device ID should be qpu:uk:-1:1234567890 instead of Toshiko1 Signed-off-by: root <[email protected]> * cudaq.set_target should be just above yield line Signed-off-by: Noriyuki Kushida <[email protected]> --------- Signed-off-by: jamie <[email protected]> Signed-off-by: root <[email protected]> Signed-off-by: Noriyuki Kushida <[email protected]> Co-authored-by: Noriyuki Kushida <[email protected]>
- Loading branch information
1 parent
d003d13
commit 3300b12
Showing
4 changed files
with
156 additions
and
72 deletions.
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 |
---|---|---|
|
@@ -33,11 +33,9 @@ def assert_close(got) -> bool: | |
@pytest.fixture(scope="session", autouse=True) | ||
def startUpMockServer(): | ||
|
||
os.environ["OQC_PASSWORD"] = "password" | ||
# Set the targeted QPU | ||
cudaq.set_target('oqc', | ||
url=f'http://localhost:{port}', | ||
email="[email protected]") | ||
os.environ["OQC_AUTH_TOKEN"] = "fake_auth_token" | ||
os.environ["OQC_DEVICE"] = "qpu:uk:-1:1234567890" | ||
os.environ["OQC_URL"] = f"http://localhost:{port}" | ||
|
||
# Launch the Mock Server | ||
p = Process(target=startServer, args=(port,)) | ||
|
@@ -48,6 +46,10 @@ def startUpMockServer(): | |
pytest.exit("Mock server did not start in time, skipping tests.", | ||
returncode=1) | ||
|
||
# Set the targeted QPU | ||
cudaq.set_target('oqc', | ||
url=f'http://localhost:{port}', | ||
auth_token="fake_auth_token") | ||
yield "Running the tests." | ||
|
||
# Kill the server, remove the file | ||
|
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
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 |
---|---|---|
|
@@ -13,10 +13,11 @@ | |
#include <gtest/gtest.h> | ||
|
||
std::string mockPort = "62442"; | ||
std::string email = "[email protected]"; | ||
std::string password = "password"; | ||
std::string auth_token = "fake_auth_token"; | ||
std::string device_id = "qpu:uk:-1:1234567890"; | ||
std::string entry_url = "http://localhost:" + mockPort; | ||
std::string backendStringTemplate = | ||
"oqc;emulate;false;url;http://localhost:{};email;{};password;{}"; | ||
"oqc;emulate;false;url;http://localhost:{};auth_token;{};device;{};"; | ||
|
||
bool isValidExpVal(double value) { | ||
// give us some wiggle room while keep the tests fast | ||
|
@@ -25,7 +26,7 @@ bool isValidExpVal(double value) { | |
|
||
CUDAQ_TEST(OQCTester, checkSampleSync) { | ||
auto backendString = fmt::format(fmt::runtime(backendStringTemplate), | ||
mockPort, email, password); | ||
mockPort, auth_token, device_id); | ||
|
||
auto &platform = cudaq::get_platform(); | ||
platform.setTargetBackend(backendString); | ||
|
@@ -42,7 +43,7 @@ CUDAQ_TEST(OQCTester, checkSampleSync) { | |
|
||
CUDAQ_TEST(OQCTester, checkSampleAsync) { | ||
auto backendString = fmt::format(fmt::runtime(backendStringTemplate), | ||
mockPort, email, password); | ||
mockPort, auth_token, device_id); | ||
|
||
auto &platform = cudaq::get_platform(); | ||
platform.setTargetBackend(backendString); | ||
|
@@ -59,7 +60,7 @@ CUDAQ_TEST(OQCTester, checkSampleAsync) { | |
|
||
CUDAQ_TEST(OQCTester, checkSampleAsyncLoadFromFile) { | ||
auto backendString = fmt::format(fmt::runtime(backendStringTemplate), | ||
mockPort, email, password); | ||
mockPort, auth_token, device_id); | ||
|
||
auto &platform = cudaq::get_platform(); | ||
platform.setTargetBackend(backendString); | ||
|
@@ -92,7 +93,7 @@ CUDAQ_TEST(OQCTester, checkSampleAsyncLoadFromFile) { | |
|
||
CUDAQ_TEST(OQCTester, checkObserveSync) { | ||
auto backendString = fmt::format(fmt::runtime(backendStringTemplate), | ||
mockPort, email, password); | ||
mockPort, auth_token, device_id); | ||
|
||
auto &platform = cudaq::get_platform(); | ||
platform.setTargetBackend(backendString); | ||
|
@@ -115,7 +116,7 @@ CUDAQ_TEST(OQCTester, checkObserveSync) { | |
|
||
CUDAQ_TEST(OQCTester, checkObserveAsync) { | ||
auto backendString = fmt::format(fmt::runtime(backendStringTemplate), | ||
mockPort, email, password); | ||
mockPort, auth_token, device_id); | ||
|
||
auto &platform = cudaq::get_platform(); | ||
platform.setTargetBackend(backendString); | ||
|
@@ -140,7 +141,7 @@ CUDAQ_TEST(OQCTester, checkObserveAsync) { | |
|
||
CUDAQ_TEST(OQCTester, checkObserveAsyncLoadFromFile) { | ||
auto backendString = fmt::format(fmt::runtime(backendStringTemplate), | ||
mockPort, email, password); | ||
mockPort, auth_token, device_id); | ||
|
||
auto &platform = cudaq::get_platform(); | ||
platform.setTargetBackend(backendString); | ||
|
@@ -177,7 +178,9 @@ CUDAQ_TEST(OQCTester, checkObserveAsyncLoadFromFile) { | |
} | ||
|
||
int main(int argc, char **argv) { | ||
setenv("OQC_PASSWORD", password.c_str(), 0); | ||
setenv("OQC_URL", entry_url.c_str(), 0); | ||
setenv("OQC_AUTH_TOKEN", auth_token.c_str(), 0); | ||
setenv("OQC_DEVICE", device_id.c_str(), 0); | ||
::testing::InitGoogleTest(&argc, argv); | ||
return RUN_ALL_TESTS(); | ||
} |
Oops, something went wrong.