From 5295a1025bf3d8093a1ed1cdf4a750b5d4567b21 Mon Sep 17 00:00:00 2001 From: Michael Krotscheck Date: Tue, 30 Aug 2016 15:30:54 -0700 Subject: [PATCH] Added more verbose logging to keystone functional tests. This will assist in debugging DSVM errors. Change-Id: Ieeee59722e203e763a50f427db55188bc683f21d --- test/functional/keystoneTest.js | 42 +++++++++++++++++---------------- 1 file changed, 22 insertions(+), 20 deletions(-) diff --git a/test/functional/keystoneTest.js b/test/functional/keystoneTest.js index 95408e0..aa6d77c 100644 --- a/test/functional/keystoneTest.js +++ b/test/functional/keystoneTest.js @@ -34,7 +34,9 @@ describe("Keystone", () => { expect(versions.length > 0).toBeTruthy(); done(); }) - .catch((error) => done.fail(error)); + .catch((response) => response.json() + .then((body) => done.fail(JSON.stringify(body))) + ); }); }); @@ -65,7 +67,9 @@ describe("Keystone", () => { fail("Current devstack keystone version is not supported."); done(); }) - .catch((error) => done.fail(error)); + .catch((response) => response.json() + .then((body) => done.fail(JSON.stringify(body))) + ); }); }); @@ -83,11 +87,9 @@ describe("Keystone", () => { expect(token).not.toBeNull(); done(); }) - .catch((error) => { - // Fail this test. - expect(error).toBeNull(); - done(); - }); + .catch((response) => response.json() + .then((body) => done.fail(JSON.stringify(body))) + ); }); it("should permit passing your own user, password, and project.", (done) => { @@ -102,21 +104,15 @@ describe("Keystone", () => { expect(token).not.toBeNull(); done(); }) - .catch((error) => { - // Fail this test. - expect(error).toBeNull(); - done(); - }); + .catch((response) => response.json() + .then((body) => done.fail(JSON.stringify(body))) + ); }); it("should throw an exception if invalid credentials are provided.", (done) => { keystone .tokenIssue('foo', 'bar', 'lolProject', 'notADomain', 'notADomain') - .then((token) => { - // Fail this test. - expect(token).toBeNull(); - done(); - }) + .then((token) => done.fail(token)) .catch((error) => { expect(error).not.toBeNull(); done(); @@ -141,7 +137,9 @@ describe("Keystone", () => { expect(response.status).toBe(204); // No content done(); }) - .catch((error) => done.fail(error)); + .catch((response) => response.json() + .then((body) => done.fail(JSON.stringify(body))) + ); }); it("should allow an admin to revoke another token.", (done) => { @@ -158,7 +156,9 @@ describe("Keystone", () => { expect(response.status).toBe(204); // No content done(); }) - .catch((error) => done.fail(error)); + .catch((response) => response.json() + .then((body) => done.fail(JSON.stringify(body))) + ); }); it("should throw an exception if invalid token is provided.", (done) => { @@ -188,7 +188,9 @@ describe("Keystone", () => { expect(catalog.length).not.toBe(0); done(); }) - .catch((error) => done.fail(error)); + .catch((response) => response.json() + .then((body) => done.fail(JSON.stringify(body))) + ); }); it("should error if not authenticated.", (done) => {