Skip to content

Commit 1a427a8

Browse files
committed
Fix tests
1 parent 1cf0af2 commit 1a427a8

File tree

4 files changed

+5
-4
lines changed

4 files changed

+5
-4
lines changed

.mocharc.js

-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1212
// See the License for the specific language governing permissions and
1313
// limitations under the License.
14-
1514
const config = {
1615
"enable-source-maps": true,
1716
"throw-deprecation": true,

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@
5959
"@google-cloud/precise-date": "^4.0.0",
6060
"@google-cloud/projectify": "^4.0.0",
6161
"@google-cloud/promisify": "4.0.0",
62-
"@grpc/grpc-js": "^1.13.3",
62+
"@grpc/grpc-js": "^1.13.2",
6363
"@grpc/proto-loader": "^0.7.0",
6464
"@opentelemetry/api": "^1.9.0",
6565
"@opentelemetry/context-async-hooks": "^1.26.0",

src/metrics/spanner-metrics-exporter.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,8 @@ import {ExporterOptions} from './external-types';
2222
import {GoogleAuth, JWT} from 'google-auth-library';
2323
import {monitoring_v3} from 'googleapis';
2424
import {transformResourceMetricToTimeSeriesArray} from './transform';
25-
import {version} from '../../package.json';
2625
import {status} from '@grpc/grpc-js';
26+
const version = require('../../../package.json').version;
2727

2828
// Stackdriver Monitoring v3 only accepts up to 200 TimeSeries per
2929
// CreateTimeSeries call.

test/metrics/spanner-metrics-exporter.test.ts

+3-1
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,8 @@ const INSTANCE_ID = 'test_instance';
3434
const DATABASE_ID = 'test_db';
3535

3636
const auth = new GoogleAuth();
37-
process.env.GCLOUD_PROJECT = PROJECT_ID;
37+
auth.getProjectId = sinon.stub().resolves(PROJECT_ID);
38+
3839
// Ensure custom exporter is valid
3940
describe('CustomExporter', () => {
4041
it('should construct an exporter', () => {
@@ -50,6 +51,7 @@ describe('CustomExporter', () => {
5051
private_key: '',
5152
},
5253
});
54+
auth.getProjectId = sinon.stub().resolves(PROJECT_ID);
5355
const exporter = new CloudMonitoringMetricsExporter({auth});
5456

5557
assert(exporter);

0 commit comments

Comments
 (0)