Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Azure Monitor Exporter] Separate tests into internal and public folders #15932

Merged
merged 12 commits into from
Jun 28, 2021
Merged
6 changes: 3 additions & 3 deletions sdk/monitor/monitor-opentelemetry-exporter/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,11 @@
"test:node": "npm run unit-test:node",
"test:browser": "npm run unit-test:browser",
"unit-test:browser": "echo skipped",
"unit-test:node": "nyc mocha -r esm --require ts-node/register --reporter ../../../common/tools/mocha-multi-reporter.js --timeout 1200000 --full-trace \"test/unit/**/*.test.ts\"",
"unit-test:node:debug": "nyc mocha --inspect-brk -r esm --require ts-node/register --reporter ../../../common/tools/mocha-multi-reporter.js --timeout 1200000 --full-trace \"test/unit/**/*.test.ts\"",
"unit-test:node": "nyc mocha -r esm --require ts-node/register --reporter ../../../common/tools/mocha-multi-reporter.js --timeout 1200000 --full-trace \"test/internal/**/*.test.ts\" \"test/public/**/*.test.ts\"",
"unit-test:node:debug": "nyc mocha --inspect-brk -r esm --require ts-node/register --reporter ../../../common/tools/mocha-multi-reporter.js --timeout 1200000 --full-trace \"test/internal/**/*.test.ts\" \"test/public/**/*.test.ts\"",
"unit-test:node:no-timeout": "echo skipped",
"unit-test": "npm run unit-test:node && npm run unit-test:browser",
"functional-test": "nyc mocha -r esm --require ts-node/register --reporter ../../../common/tools/mocha-multi-reporter.js --timeout 1200000 --full-trace \"test/functional/**/*.test.ts\"",
"functional-test": "nyc mocha -r esm --require ts-node/register --reporter ../../../common/tools/mocha-multi-reporter.js --timeout 1200000 --full-trace \"test/internal/functional/*.test.ts\"",
"integration-test:browser": "echo skipped",
"integration-test:node": "npm run functional-test",
"integration-test": "npm run integration-test:node && npm run integration-test:browser",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
// Licensed under the MIT license.

import * as assert from "assert";
import * as Constants from "../../../src/Declarations/Constants";
import { ConnectionStringParser } from "../../../src/utils/connectionStringParser";
import * as Constants from "../../src/Declarations/Constants";
import { ConnectionStringParser } from "../../src/utils/connectionStringParser";

describe("ConnectionStringParser", () => {
describe("#parse()", () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,14 @@ import { SpanAttributes, HrTime, SpanContext, SpanKind, ROOT_CONTEXT } from "@op
import { timeInputToHrTime } from "@opentelemetry/core";
import { BasicTracerProvider, Span } from "@opentelemetry/tracing";
import * as assert from "assert";
import {
ENQUEUED_TIME,
TIME_SINCE_ENQUEUED
} from "../../../src/utils/constants/applicationinsights";
import { ENQUEUED_TIME, TIME_SINCE_ENQUEUED } from "../../src/utils/constants/applicationinsights";
import {
AzNamespace,
MessageBusDestination,
MicrosoftEventHub
} from "../../../src/utils/constants/span/azAttributes";
import { parseEventHubSpan } from "../../../src/utils/eventhub";
import { RemoteDependencyData, TelemetryItem as Envelope } from "../../../src/generated";
} from "../../src/utils/constants/span/azAttributes";
import { parseEventHubSpan } from "../../src/utils/eventhub";
import { RemoteDependencyData, TelemetryItem as Envelope } from "../../src/generated";

const tracer = new BasicTracerProvider().getTracer("default");

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ import * as assert from "assert";
import * as fs from "fs";
import * as os from "os";
import * as path from "path";
import { FileSystemPersist } from "../../../../../src/platform/nodejs/persist/fileSystemPersist";
import { TelemetryItem as Envelope } from "../../../../../src/generated";
import { FileSystemPersist } from "../../src/platform/nodejs/persist/fileSystemPersist";
import { TelemetryItem as Envelope } from "../../src/generated";
import { promisify } from "util";

const statAsync = promisify(fs.stat);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT license.

import { assertCount, assertExpectation } from "../common/assert";
import { BasicScenario } from "../common/scenario/basic";
import { DEFAULT_BREEZE_ENDPOINT } from "../../src/Declarations/Constants";
import { assertCount, assertExpectation } from "../../utils/assert";
import { BasicScenario } from "../../utils/basic";
import { DEFAULT_BREEZE_ENDPOINT } from "../../../src/Declarations/Constants";
import nock from "nock";
import { successfulBreezeResponse } from "../unit/breezeTestUtils";
import { TelemetryItem as Envelope } from "../../src/generated";
import { successfulBreezeResponse } from "../../utils/breezeTestUtils";
import { TelemetryItem as Envelope } from "../../../src/generated";

describe("Trace Exporter Scenarios", () => {
describe(BasicScenario.prototype.constructor.name, () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@
// Licensed under the MIT license.

import * as assert from "assert";
import { DEFAULT_EXPORTER_CONFIG } from "../../../../src/config";
import { HttpSender } from "../../../../src/platform/nodejs/httpSender";
import { DEFAULT_BREEZE_ENDPOINT } from "../../../../src/Declarations/Constants";
import { DEFAULT_EXPORTER_CONFIG } from "../../src/config";
import { HttpSender } from "../../src/platform/nodejs/httpSender";
import { DEFAULT_BREEZE_ENDPOINT } from "../../src/Declarations/Constants";
import {
successfulBreezeResponse,
failedBreezeResponse,
partialBreezeResponse
} from "../../breezeTestUtils";
import { TelemetryItem as Envelope } from "../../../../src/generated";
} from "../utils/breezeTestUtils";
import { TelemetryItem as Envelope } from "../../src/generated";
import nock from "nock";

describe("HttpSender", () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,19 +7,19 @@ import * as assert from "assert";
import { hrTimeToMilliseconds } from "@opentelemetry/core";
import { Resource, SERVICE_RESOURCE } from "@opentelemetry/resources";

import { Tags, Properties, Measurements } from "../../../src/types";
import { Tags, Properties, Measurements } from "../../src/types";
import {
AI_CLOUD_ROLE,
AI_CLOUD_ROLE_INSTACE
} from "../../../src/utils/constants/applicationinsights";
import * as http from "../../../src/utils/constants/span/httpAttributes";
import * as grpc from "../../../src/utils/constants/span/grpcAttributes";
import * as ai from "../../../src/utils/constants/applicationinsights";
import { Context, getInstance } from "../../../src/platform";
import { msToTimeSpan } from "../../../src/utils/breezeUtils";
import { readableSpanToEnvelope } from "../../../src/utils/spanUtils";
import { RemoteDependencyData, RequestData } from "../../../src/generated";
import { TelemetryItem as Envelope } from "../../../src/generated";
} from "../../src/utils/constants/applicationinsights";
import * as http from "../../src/utils/constants/span/httpAttributes";
import * as grpc from "../../src/utils/constants/span/grpcAttributes";
import * as ai from "../../src/utils/constants/applicationinsights";
import { Context, getInstance } from "../../src/platform";
import { msToTimeSpan } from "../../src/utils/breezeUtils";
import { readableSpanToEnvelope } from "../../src/utils/spanUtils";
import { RemoteDependencyData, RequestData } from "../../src/generated";
import { TelemetryItem as Envelope } from "../../src/generated";

const context = getInstance(undefined, "./");

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,21 +3,22 @@

import * as assert from "assert";
import { ExportResult, ExportResultCode } from "@opentelemetry/core";
import { AzureMonitorTraceExporter } from "../../../src/export/trace";
import { DEFAULT_BREEZE_ENDPOINT } from "../../../src/Declarations/Constants";
import { AzureMonitorTraceExporter } from "../../src/export/trace";
import {
failedBreezeResponse,
partialBreezeResponse,
successfulBreezeResponse
} from "../breezeTestUtils";
import { FileSystemPersist, HttpSender } from "../../../src/platform";
import { TelemetryItem as Envelope } from "../../../src/generated";
} from "../utils/breezeTestUtils";
import { FileSystemPersist, HttpSender } from "../../src/platform";
import { TelemetryItem as Envelope } from "../../src/generated";
import nock from "nock";

function toObject<T>(obj: T): T {
return JSON.parse(JSON.stringify(obj)) as T;
}

const DEFAULT_BREEZE_ENDPOINT = "https://dc.services.visualstudio.com";

describe("#AzureMonitorBaseExporter", () => {
class TestExporter extends AzureMonitorTraceExporter {
private thisAsAny: any;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import {
AI_OPERATION_ID,
AI_OPERATION_PARENT_ID
} from "../../src/utils/constants/applicationinsights";
import { Expectation } from "./scenario/types";
import { Expectation } from "./types";
import { MonitorBase, RequestData, TelemetryItem as Envelope } from "../../src/generated";
import { TelemetryItem as EnvelopeMapper } from "../../src/generated/models/mappers";

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@

import * as opentelemetry from "@opentelemetry/api";
import { BasicTracerProvider } from "@opentelemetry/tracing";
import { AzureMonitorTraceExporter } from "../../../src";
import { AzureMonitorTraceExporter } from "../../src";
import { Expectation, Scenario } from "./types";
import { msToTimeSpan } from "../../../src/utils/breezeUtils";
import { msToTimeSpan } from "../../src/utils/breezeUtils";
import { SpanStatusCode } from "@opentelemetry/api";
import { FlushSpanProcessor } from "../flushSpanProcessor";
import { FlushSpanProcessor } from "./flushSpanProcessor";
import { delay } from "@azure/core-http";
import { TelemetryItem as Envelope } from "../../../src/generated";
import { TelemetryItem as Envelope } from "../../src/generated";

const COMMON_ENVELOPE_PARAMS: Partial<Envelope> = {
instrumentationKey: process.env.APPINSIGHTS_INSTRUMENTATIONKEY || "ikey",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT license.

import { TelemetryItem as Envelope } from "../../../src/generated";
import { TelemetryItem as Envelope } from "../../src/generated";

export interface Expectation extends Partial<Envelope> {
children: Expectation[];
Expand Down
2 changes: 0 additions & 2 deletions sdk/monitor/monitor-opentelemetry-exporter/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,5 @@ stages:
TimeoutInMinutes: 15
PackageName: "@azure/monitor-opentelemetry-exporter"
ServiceDirectory: monitor
MatrixFilters:
- DependencyVersion=^$
PostSteps:
- template: /eng/pipelines/templates/steps/monitor-additional-steps.yml