Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
G
Grpc
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
tci-gateway-module
Grpc
Commits
c67aaea2
Commit
c67aaea2
authored
Mar 20, 2015
by
Tim Emiola
Browse files
Options
Downloads
Plain Diff
Merge pull request #1105 from murgatroid99/node_compute_engine_creds_test_fix
Fix Node Compute Engine Auth test
parents
3bd5fa6c
90da75ed
No related branches found
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/node/interop/interop_client.js
+8
-4
8 additions, 4 deletions
src/node/interop/interop_client.js
with
8 additions
and
4 deletions
src/node/interop/interop_client.js
+
8
−
4
View file @
c67aaea2
...
@@ -35,6 +35,7 @@
...
@@ -35,6 +35,7 @@
var
fs
=
require
(
'
fs
'
);
var
fs
=
require
(
'
fs
'
);
var
path
=
require
(
'
path
'
);
var
path
=
require
(
'
path
'
);
var
_
=
require
(
'
underscore
'
);
var
grpc
=
require
(
'
..
'
);
var
grpc
=
require
(
'
..
'
);
var
testProto
=
grpc
.
load
(
__dirname
+
'
/test.proto
'
).
grpc
.
testing
;
var
testProto
=
grpc
.
load
(
__dirname
+
'
/test.proto
'
).
grpc
.
testing
;
var
GoogleAuth
=
require
(
'
google-auth-library
'
);
var
GoogleAuth
=
require
(
'
google-auth-library
'
);
...
@@ -45,6 +46,8 @@ var AUTH_SCOPE = 'https://www.googleapis.com/auth/xapi.zoo';
...
@@ -45,6 +46,8 @@ var AUTH_SCOPE = 'https://www.googleapis.com/auth/xapi.zoo';
var
AUTH_SCOPE_RESPONSE
=
'
xapi.zoo
'
;
var
AUTH_SCOPE_RESPONSE
=
'
xapi.zoo
'
;
var
AUTH_USER
=
(
'
155450119199-3psnrh1sdr3d8cpj1v46naggf81mhdnk
'
+
var
AUTH_USER
=
(
'
155450119199-3psnrh1sdr3d8cpj1v46naggf81mhdnk
'
+
'
@developer.gserviceaccount.com
'
);
'
@developer.gserviceaccount.com
'
);
var
COMPUTE_ENGINE_USER
=
(
'
155450119199-r5aaqa2vqoa9g5mv2m6s3m1l293rlmel
'
+
'
@developer.gserviceaccount.com
'
);
/**
/**
* Create a buffer filled with size zeroes
* Create a buffer filled with size zeroes
...
@@ -265,11 +268,12 @@ function cancelAfterFirstResponse(client, done) {
...
@@ -265,11 +268,12 @@ function cancelAfterFirstResponse(client, done) {
/**
/**
* Run one of the authentication tests.
* Run one of the authentication tests.
* @param {string} expected_user The expected username in the response
* @param {Client} client The client to test against
* @param {Client} client The client to test against
* @param {function} done Callback to call when the test is completed. Included
* @param {function} done Callback to call when the test is completed. Included
* primarily for use with mocha
* primarily for use with mocha
*/
*/
function
authTest
(
client
,
done
)
{
function
authTest
(
expected_user
,
client
,
done
)
{
(
new
GoogleAuth
()).
getApplicationDefault
(
function
(
err
,
credential
)
{
(
new
GoogleAuth
()).
getApplicationDefault
(
function
(
err
,
credential
)
{
assert
.
ifError
(
err
);
assert
.
ifError
(
err
);
if
(
credential
.
createScopedRequired
())
{
if
(
credential
.
createScopedRequired
())
{
...
@@ -290,7 +294,7 @@ function authTest(client, done) {
...
@@ -290,7 +294,7 @@ function authTest(client, done) {
assert
.
strictEqual
(
resp
.
payload
.
type
,
testProto
.
PayloadType
.
COMPRESSABLE
);
assert
.
strictEqual
(
resp
.
payload
.
type
,
testProto
.
PayloadType
.
COMPRESSABLE
);
assert
.
strictEqual
(
resp
.
payload
.
body
.
limit
-
resp
.
payload
.
body
.
offset
,
assert
.
strictEqual
(
resp
.
payload
.
body
.
limit
-
resp
.
payload
.
body
.
offset
,
314159
);
314159
);
assert
.
strictEqual
(
resp
.
username
,
AUTH_USER
);
assert
.
strictEqual
(
resp
.
username
,
expected_user
);
assert
.
strictEqual
(
resp
.
oauth_scope
,
AUTH_SCOPE_RESPONSE
);
assert
.
strictEqual
(
resp
.
oauth_scope
,
AUTH_SCOPE_RESPONSE
);
});
});
call
.
on
(
'
status
'
,
function
(
status
)
{
call
.
on
(
'
status
'
,
function
(
status
)
{
...
@@ -314,8 +318,8 @@ var test_cases = {
...
@@ -314,8 +318,8 @@ var test_cases = {
empty_stream
:
emptyStream
,
empty_stream
:
emptyStream
,
cancel_after_begin
:
cancelAfterBegin
,
cancel_after_begin
:
cancelAfterBegin
,
cancel_after_first_response
:
cancelAfterFirstResponse
,
cancel_after_first_response
:
cancelAfterFirstResponse
,
compute_engine_creds
:
authTest
,
compute_engine_creds
:
_
.
partial
(
authTest
,
AUTH_USER
)
,
service_account_creds
:
authTest
service_account_creds
:
_
.
partial
(
authTest
,
COMPUTE_ENGINE_USER
)
};
};
/**
/**
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
sign in
to comment