@@ -35,7 +35,6 @@ describe('metadata', function() {
3535 var Metadata ;
3636 var metadata ;
3737
38- var PROJECT_ID = 'project-id' ;
3938 var LOGGING ;
4039
4140 var ENV_CACHED = extend ( { } , process . env ) ;
@@ -77,10 +76,9 @@ describe('metadata', function() {
7776 } ) ;
7877
7978 it ( 'should return the correct descriptor' , function ( ) {
80- assert . deepEqual ( Metadata . getCloudFunctionDescriptor ( PROJECT_ID ) , {
79+ assert . deepEqual ( Metadata . getCloudFunctionDescriptor ( ) , {
8180 type : 'cloud_function' ,
8281 labels : {
83- project_id : PROJECT_ID ,
8482 function_name : FUNCTION_NAME ,
8583 region : SUPERVISOR_REGION
8684 }
@@ -100,10 +98,9 @@ describe('metadata', function() {
10098 } ) ;
10199
102100 it ( 'should return the correct descriptor' , function ( ) {
103- assert . deepEqual ( Metadata . getGAEDescriptor ( PROJECT_ID ) , {
101+ assert . deepEqual ( Metadata . getGAEDescriptor ( ) , {
104102 type : 'gae_app' ,
105103 labels : {
106- project_id : PROJECT_ID ,
107104 module_id : GAE_SERVICE ,
108105 version_id : GAE_VERSION
109106 }
@@ -113,7 +110,7 @@ describe('metadata', function() {
113110 it ( 'should use GAE_MODULE_NAME for module_id' , function ( ) {
114111 delete process . env . GAE_SERVICE ;
115112
116- var moduleId = Metadata . getGAEDescriptor ( PROJECT_ID ) . labels . module_id ;
113+ var moduleId = Metadata . getGAEDescriptor ( ) . labels . module_id ;
117114 assert . strictEqual ( moduleId , GAE_MODULE_NAME ) ;
118115 } ) ;
119116 } ) ;
@@ -124,13 +121,12 @@ describe('metadata', function() {
124121 it ( 'should return the correct descriptor' , function ( done ) {
125122 instanceArgsOverride = [ null , null , CLUSTER_NAME ] ;
126123
127- Metadata . getGKEDescriptor ( PROJECT_ID , function ( err , descriptor ) {
124+ Metadata . getGKEDescriptor ( function ( err , descriptor ) {
128125 assert . ifError ( err ) ;
129126 assert . deepEqual ( descriptor , {
130127 type : 'container' ,
131128 labels : {
132- cluster_name : CLUSTER_NAME ,
133- project_id : PROJECT_ID
129+ cluster_name : CLUSTER_NAME
134130 }
135131 } ) ;
136132 done ( ) ;
@@ -141,7 +137,7 @@ describe('metadata', function() {
141137 var FAKE_ERROR = new Error ( ) ;
142138 instanceArgsOverride = [ FAKE_ERROR ] ;
143139
144- Metadata . getGKEDescriptor ( PROJECT_ID , function ( err ) {
140+ Metadata . getGKEDescriptor ( function ( err ) {
145141 assert . strictEqual ( err , FAKE_ERROR ) ;
146142 done ( ) ;
147143 } ) ;
@@ -150,56 +146,21 @@ describe('metadata', function() {
150146
151147 describe ( 'getGCEDescriptor' , function ( ) {
152148 it ( 'should return the correct descriptor' , function ( ) {
153- assert . deepEqual ( Metadata . getGCEDescriptor ( PROJECT_ID ) , {
154- type : 'gce_instance' ,
155- labels : {
156- project_id : PROJECT_ID
157- }
149+ assert . deepEqual ( Metadata . getGCEDescriptor ( ) , {
150+ type : 'gce_instance'
158151 } ) ;
159152 } ) ;
160153 } ) ;
161154
162155 describe ( 'getGlobalDescriptor' , function ( ) {
163156 it ( 'should return the correct descriptor' , function ( ) {
164- assert . deepEqual ( Metadata . getGlobalDescriptor ( PROJECT_ID ) , {
165- type : 'global' ,
166- labels : {
167- project_id : PROJECT_ID
168- }
157+ assert . deepEqual ( Metadata . getGlobalDescriptor ( ) , {
158+ type : 'global'
169159 } ) ;
170160 } ) ;
171161 } ) ;
172162
173163 describe ( 'getDefaultResource' , function ( ) {
174- var RETURNED_PROJECT_ID = 'project-id' ;
175-
176- beforeEach ( function ( ) {
177- metadata . logging . auth . getProjectId = function ( callback ) {
178- callback ( null , RETURNED_PROJECT_ID ) ;
179- } ;
180- } ) ;
181-
182- it ( 'should get the project ID' , function ( done ) {
183- metadata . logging . auth . getProjectId = function ( ) {
184- done ( ) ;
185- } ;
186-
187- metadata . getDefaultResource ( assert . ifError ) ;
188- } ) ;
189-
190- it ( 'should return error from getProjectId' , function ( done ) {
191- var error = new Error ( 'Error.' ) ;
192-
193- metadata . logging . auth . getProjectId = function ( callback ) {
194- callback ( error ) ;
195- } ;
196-
197- metadata . getDefaultResource ( function ( err ) {
198- assert . strictEqual ( err , error ) ;
199- done ( ) ;
200- } ) ;
201- } ) ;
202-
203164 it ( 'should get the environment from auth client' , function ( done ) {
204165 metadata . logging . auth . getEnvironment = function ( ) {
205166 done ( ) ;
@@ -213,8 +174,7 @@ describe('metadata', function() {
213174 it ( 'should return correct descriptor' , function ( done ) {
214175 var DESCRIPTOR = { } ;
215176
216- Metadata . getGAEDescriptor = function ( projectId ) {
217- assert . strictEqual ( projectId , RETURNED_PROJECT_ID ) ;
177+ Metadata . getGAEDescriptor = function ( ) {
218178 return DESCRIPTOR ;
219179 } ;
220180
@@ -237,8 +197,7 @@ describe('metadata', function() {
237197 it ( 'should return correct descriptor' , function ( done ) {
238198 var DESCRIPTOR = { } ;
239199
240- Metadata . getCloudFunctionDescriptor = function ( projectId ) {
241- assert . strictEqual ( projectId , RETURNED_PROJECT_ID ) ;
200+ Metadata . getCloudFunctionDescriptor = function ( ) {
242201 return DESCRIPTOR ;
243202 } ;
244203
@@ -261,8 +220,7 @@ describe('metadata', function() {
261220 it ( 'should return correct descriptor' , function ( done ) {
262221 var DESCRIPTOR = { } ;
263222
264- Metadata . getGCEDescriptor = function ( projectId ) {
265- assert . strictEqual ( projectId , RETURNED_PROJECT_ID ) ;
223+ Metadata . getGCEDescriptor = function ( ) {
266224 return DESCRIPTOR ;
267225 } ;
268226
@@ -297,8 +255,7 @@ describe('metadata', function() {
297255 assert . deepStrictEqual ( defaultResource , {
298256 type : 'container' ,
299257 labels : {
300- cluster_name : CLUSTER_NAME ,
301- project_id : RETURNED_PROJECT_ID
258+ cluster_name : CLUSTER_NAME
302259 }
303260 } ) ;
304261 done ( ) ;
@@ -310,8 +267,7 @@ describe('metadata', function() {
310267 it ( 'should return correct descriptor' , function ( done ) {
311268 var DESCRIPTOR = { } ;
312269
313- Metadata . getGlobalDescriptor = function ( projectId ) {
314- assert . strictEqual ( projectId , RETURNED_PROJECT_ID ) ;
270+ Metadata . getGlobalDescriptor = function ( ) {
315271 return DESCRIPTOR ;
316272 } ;
317273
0 commit comments