Thanks to visit codestin.com
Credit goes to github.com

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
2 changes: 1 addition & 1 deletion .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ jobs:

ci:
name: Build Image and Push
uses: uc-cdis/.github/.github/workflows/image_build_push.yaml@master
uses: uc-cdis/.github/.github/workflows/image_build_push_native.yaml@master
secrets:
ECR_AWS_ACCESS_KEY_ID: ${{ secrets.ECR_AWS_ACCESS_KEY_ID }}
ECR_AWS_SECRET_ACCESS_KEY: ${{ secrets.ECR_AWS_SECRET_ACCESS_KEY }}
Expand Down
187 changes: 157 additions & 30 deletions src/server/__mocks__/mockESData/mockNumericHistogramFixBinCount.js
Original file line number Diff line number Diff line change
Expand Up @@ -115,26 +115,24 @@ const mockHistogramFixBinCount = () => {
bool: {
must: [
{
term: {
gender: 'female',
range: {
file_count: {
gte: 2,
},
},
},
[
{
range: {
file_count: {
gte: 2,
},
{
range: {
file_count: {
lt: 99,
},
},
{
range: {
file_count: {
lt: 99,
},
},
},
{
term: {
gender: 'female',
},
],
},
],
},
},
Expand Down Expand Up @@ -336,26 +334,27 @@ const mockHistogramFixBinCount = () => {
bool: {
must: [
{
terms: {
gen3_resource_path: ['internal-project-1', 'internal-project-2'],
range: {
file_count: {
gte: 20,
},
},
},
[
{
range: {
file_count: {
gte: 20,
},
{
range: {
file_count: {
lt: 81,
},
},
{
range: {
file_count: {
lt: 81,
},
},
},
{
terms: {
gen3_resource_path: [
'internal-project-1',
'internal-project-2',
],
},
],
},
],
},
},
Expand Down Expand Up @@ -442,6 +441,134 @@ const mockHistogramFixBinCount = () => {
},
};
mockSearchEndpoint(fileCountHistogramFixBinCountQuery3, fileCountHistogramFixBinCountResult3);

// with nestedPath and binCount applied
const fileCountHistogramFixBinCountQuery4 = {
size: 0,
query: {
bool: {
must: [
{
nested: {
path: 'visits.follow_ups',
query: {
bool: {
must: [
{
range: {
'visits.follow_ups.days_to_follow_up': {
gte: 1,
},
},
},
{
range: {
'visits.follow_ups.days_to_follow_up': {
lt: 4,
},
},
},
],
},
},
},
},
],
},
},
aggs: {
numeric_nested_aggs: {
nested: {
path: 'visits.follow_ups',
},
aggs: {
numeric_aggs_stats: {
stats: {
field: 'visits.follow_ups.days_to_follow_up',
},
},
numeric_aggs: {
histogram: {
field: 'visits.follow_ups.days_to_follow_up',
interval: 0.75,
offset: 0.25,
},
aggs: {
numeric_item_aggs_stats: {
stats: {
field: 'visits.follow_ups.days_to_follow_up',
},
},
},
},
},
},
},
track_total_hits: true,
};
const fileCountHistogramFixBinCountResult4 = {
aggregations: {
numeric_nested_aggs: {
doc_count: 31,
numeric_aggs: {
buckets: [
{
key: 1.0,
doc_count: 12,
numeric_item_aggs_stats: {
count: 12,
min: 1.0,
max: 1.0,
avg: 1.0,
sum: 12.0,
},
},
{
key: 2.0,
doc_count: 19,
numeric_item_aggs_stats: {
count: 19,
min: 2.0,
max: 2.0,
avg: 2.0,
sum: 38.0,
},
},
{
key: 3.0,
doc_count: 17,
numeric_item_aggs_stats: {
count: 17,
min: 3.0,
max: 3.0,
avg: 3.0,
sum: 51.0,
},
},
{
key: 4.0,
doc_count: 6,
numeric_item_aggs_stats: {
count: 6,
min: 4.0,
max: 4.0,
avg: 4.0,
sum: 24.0,
},
},
],
},
numeric_aggs_stats: {
count: 54,
min: 1.0,
max: 4.0,
avg: 2.31481481481,
sum: 125.0,
},
},
},
};
mockSearchEndpoint(fileCountHistogramFixBinCountQuery4, fileCountHistogramFixBinCountResult4);
};

export default mockHistogramFixBinCount;
40 changes: 32 additions & 8 deletions src/server/auth/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,22 @@ export const getAccessibleResourcesFromArboristasync = async (jwt) => {
let data;
if (config.internalLocalTest) {
data = {
resources: [ // these are just for testing
'/programs/DEV/projects/test',
'/programs/jnkns/projects/jenkins',
],
// these are just for testing
'/programs/DEV/projects/test': [
{
service: '*',
method: 'read',
}],
'/programs/jnkns/projects/jenkins': [
{
service: '*',
method: 'read',
}],
'/guppy_admin': [
{
service: 'guppy',
method: 'admin_access',
}],
};
} else {
data = await arboristClient.listAuthMapping(jwt);
Expand All @@ -54,10 +66,22 @@ export const checkIfUserCanRefreshServer = async (passedData) => {
let data = passedData;
if (config.internalLocalTest) {
data = {
resources: [ // these are just for testing
'/programs/DEV/projects/test',
'/programs/jnkns/projects/jenkins',
],
// these are just for testing
'/programs/DEV/projects/test': [
{
service: '*',
method: 'read',
}],
'/programs/jnkns/projects/jenkins': [
{
service: '*',
method: 'read',
}],
'/guppy_admin': [
{
service: 'guppy',
method: 'admin_access',
}],
};
}

Expand Down
Loading
Loading