Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
46 changes: 46 additions & 0 deletions shared/AppInsightsCommon/Tests/Unit/src/ThrottleMgr.tests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -599,6 +599,52 @@ export class ThrottleMgrTest extends AITestClass {
}
});

this.testCase({
name: "ThrottleMgrTest: message can be sent from the first day when dayInterval is set to one",
test: () => {

let config = {
disabled: false,
limit: {
samplingRate: 100,
maxSendNumber:1
} as IThrottleLimit,
interval: {
dayInterval: 1
} as IThrottleInterval
} as IThrottleMgrConfig;

let expectedConfig = {
disabled: false,
limit: {
samplingRate: 100,
maxSendNumber:1
} as IThrottleLimit,
interval: {
monthInterval: undefined,
dayInterval: 1,
daysOfMonth: undefined
} as IThrottleInterval
} as IThrottleMgrConfig;

let coreCfg = {
instrumentationKey: "test",
throttleMgrCfg: {[this._msgId]: config}
};
this._core.initialize(coreCfg, [this._channel]);

let throttleMgr = new ThrottleMgr(this._core);
let actualConfig = throttleMgr.getConfig();
Assert.deepEqual(expectedConfig, actualConfig[this._msgId]);

let isTriggered = throttleMgr.isTriggered(this._msgId);
Assert.equal(isTriggered, false);

let canSend = throttleMgr.canThrottle(this._msgId);
Assert.equal(canSend, true, "can send message from the day")
}
});

this.testCase({
name: "ThrottleMgrTest: Throttle Manager should trigger when current date is in daysOfMonth",
test: () => {
Expand Down
4 changes: 2 additions & 2 deletions tools/config/config.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"version": "1.0.1",
"version": "1.0.2",
"enabled": true,
"featureOptIn": {
"iKeyUsage": {
Expand Down Expand Up @@ -53,7 +53,7 @@
"110": {
"disabled": false,
"limit": {
"samplingRate": 10000,
"samplingRate": 200000,
"maxSendNumber": 1
},
"interval": {
Expand Down
2 changes: 1 addition & 1 deletion tools/config/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "applicationinsights-web-config",
"description": "Application Insights JavaScript SDK - Web Config for CfgSync Plugin",
"version": "1.0.1",
"version": "1.0.2",
"copyright": "(c) Microsoft and contributors. All rights reserved.",
"author": "Microsoft Application Insights Team",
"repository": {
Expand Down
4 changes: 2 additions & 2 deletions tools/config/test-config.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"version": "1.0.1",
"version": "1.0.2",
"enabled": true,
"featureOptIn": {
"iKeyUsage": {
Expand Down Expand Up @@ -53,7 +53,7 @@
"110": {
"disabled": false,
"limit": {
"samplingRate": 100000,
"samplingRate": 1000000,
"maxSendNumber": 1
},
"interval": {
Expand Down
Loading