Skip to content

Commit

Permalink
Merge branch 'main' into fix-manifests
Browse files Browse the repository at this point in the history
  • Loading branch information
manushak committed Sep 11, 2024
2 parents aefca76 + 22ed978 commit 89a9d69
Show file tree
Hide file tree
Showing 27 changed files with 803 additions and 223 deletions.
8 changes: 4 additions & 4 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
"dependencies": {
"@commitlint/cli": "^18.6.0",
"@commitlint/config-conventional": "^18.6.0",
"@grnsft/if-core": "^0.0.20",
"@grnsft/if-core": "^0.0.22",
"axios": "^1.7.2",
"csv-parse": "^5.5.6",
"csv-stringify": "^6.4.6",
Expand Down
65 changes: 49 additions & 16 deletions src/__tests__/if-run/builtins/time-sync.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,10 @@ describe('builtins/time-sync:', () => {
type: 'horizontal',
};
const convertedMetrics = metricStorage.metrics.map((metric: string) => ({
[metric]: AGGREGATION_METHODS[2],
[metric]: {
time: AGGREGATION_METHODS[2],
component: AGGREGATION_METHODS[2],
},
}));
storeAggregationMetrics(...convertedMetrics);
});
Expand Down Expand Up @@ -463,12 +466,12 @@ describe('builtins/time-sync:', () => {
{
timestamp: '2023-12-12T00:00:00.000Z',
duration: 1,
'cpu/utilization': null,
'cpu/utilization': 10,
},
{
timestamp: '2023-12-12T00:00:01.000Z',
duration: 1,
'cpu/utilization': null,
'cpu/utilization': 10,
},
];

Expand All @@ -483,7 +486,12 @@ describe('builtins/time-sync:', () => {
'allow-padding': true,
};

storeAggregationMetrics({carbon: 'sum'});
storeAggregationMetrics({
carbon: {
time: 'sum',
component: 'sum',
},
});

const timeModel = TimeSync(basicConfig, parametersMetadata, {});

Expand Down Expand Up @@ -578,12 +586,12 @@ describe('builtins/time-sync:', () => {
{
timestamp: '2023-12-12T00:00:00.000Z',
duration: 5,
'resources-total': null,
'resources-total': 10,
},
{
timestamp: '2023-12-12T00:00:05.000Z',
duration: 5,
'resources-total': null,
duration: 4,
'resources-total': 10,
},
];

Expand All @@ -598,8 +606,18 @@ describe('builtins/time-sync:', () => {
'allow-padding': true,
};

storeAggregationMetrics({'time-reserved': 'avg'});
storeAggregationMetrics({'resources-total': 'sum'});
storeAggregationMetrics({
'time-reserved': {
time: 'avg',
component: 'avg',
},
});
storeAggregationMetrics({
'resources-total': {
time: 'sum',
component: 'sum',
},
});

const timeModel = TimeSync(basicConfig, parametersMetadata, {});

Expand Down Expand Up @@ -627,9 +645,9 @@ describe('builtins/time-sync:', () => {
},
{
timestamp: '2023-12-12T00:00:05.000Z',
duration: 5,
duration: 4,
'resources-total': 10,
'time-reserved': 3.2,
'time-reserved': 3.75,
},
];

Expand All @@ -647,8 +665,18 @@ describe('builtins/time-sync:', () => {
'time-reserved': 'time-allocated',
};

storeAggregationMetrics({'time-allocated': 'avg'});
storeAggregationMetrics({'resources-total': 'sum'});
storeAggregationMetrics({
'time-allocated': {
time: 'avg',
component: 'avg',
},
});
storeAggregationMetrics({
'resources-total': {
time: 'sum',
component: 'sum',
},
});

const timeModel = TimeSync(basicConfig, parametersMetadata, mapping);

Expand Down Expand Up @@ -676,9 +704,9 @@ describe('builtins/time-sync:', () => {
},
{
timestamp: '2023-12-12T00:00:05.000Z',
duration: 5,
duration: 4,
'resources-total': 10,
'time-allocated': 3.2,
'time-allocated': 3.75,
},
];

Expand Down Expand Up @@ -722,7 +750,12 @@ describe('builtins/time-sync:', () => {
'allow-padding': true,
};

storeAggregationMetrics({'resources-total': 'none'});
storeAggregationMetrics({
'resources-total': {
time: 'none',
component: 'none',
},
});

const timeModel = TimeSync(basicConfig, parametersMetadata, {});

Expand Down
12 changes: 10 additions & 2 deletions src/__tests__/if-run/lib/aggregate.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,23 @@ describe('lib/aggregate: ', () => {
type: 'horizontal',
};
const convertedMetrics = metricStorage.metrics.map((metric: string) => ({
[metric]: AGGREGATION_METHODS[2],
[metric]: {
time: AGGREGATION_METHODS[2],
component: AGGREGATION_METHODS[2],
},
}));

storeAggregationMetrics(...convertedMetrics);
});

describe('aggregate(): ', () => {
beforeAll(() => {
storeAggregationMetrics({carbon: 'sum'});
storeAggregationMetrics({
carbon: {
time: 'sum',
component: 'sum',
},
});
});

it('returns tree if aggregation is missing.', () => {
Expand Down
Loading

0 comments on commit 89a9d69

Please sign in to comment.