Skip to content

Commit

Permalink
chore: migrate to owl bot (#737)
Browse files Browse the repository at this point in the history
* chore: migrate to owl bot

* chore: copy files from googleapis-gen 397c0bfd367a2427104f988d5329bc117caafd95

* chore: run the post processor

* lint

* fix: lint

Co-authored-by: Justin Beckwith <justin.beckwith@gmail.com>
  • Loading branch information
SurferJeffAtGoogle and JustinBeckwith committed May 21, 2021
1 parent df22483 commit 776916e
Show file tree
Hide file tree
Showing 9 changed files with 64 additions and 88 deletions.
4 changes: 4 additions & 0 deletions .github/.OwlBot.lock.yaml
@@ -0,0 +1,4 @@
docker:
digest: sha256:f556e6e7be625deb1b2429fe608df27be57185c3e6b7d39ee0059f1609f17530
image: gcr.io/repo-automation-bots/owlbot-nodejs:latest

19 changes: 19 additions & 0 deletions .github/.OwlBot.yaml
@@ -0,0 +1,19 @@
# Copyright 2021 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
docker:
image: gcr.io/repo-automation-bots/owlbot-nodejs:latest


begin-after-commit-hash: 397c0bfd367a2427104f988d5329bc117caafd95

3 changes: 3 additions & 0 deletions .github/generated-files-bot.yml
Expand Up @@ -11,3 +11,6 @@ generatedFiles:
message: '`README.md` is managed by [`synthtool`](https://github.com/googleapis/synthtool). However, a partials file can be used to update the README, e.g.: https://github.com/googleapis/nodejs-storage/blob/master/.readme-partials.yaml'
- path: 'samples/README.md'
message: '`samples/README.md` is managed by [`synthtool`](https://github.com/googleapis/synthtool). However, a partials file can be used to update the README, e.g.: https://github.com/googleapis/nodejs-storage/blob/master/.readme-partials.yaml'
ignoreAuthors:
- 'gcf-owl-bot[bot]'
- 'yoshi-automation'
10 changes: 0 additions & 10 deletions .github/workflows/ci.yaml
Expand Up @@ -24,11 +24,6 @@ jobs:
- run: rm -rf node_modules
- run: npm install
- run: npm test
- name: coverage
uses: codecov/codecov-action@v1
with:
name: actions ${{ matrix.node }}
fail_ci_if_error: false
windows:
runs-on: windows-latest
steps:
Expand All @@ -38,11 +33,6 @@ jobs:
node-version: 14
- run: npm install
- run: npm test
- name: coverage
uses: codecov/codecov-action@v1
with:
name: actions windows
fail_ci_if_error: false
lint:
runs-on: ubuntu-latest
steps:
Expand Down
3 changes: 2 additions & 1 deletion src/profiler.ts
Expand Up @@ -130,7 +130,8 @@ function getServerResponseBackoff(body: object): number | undefined {
export function parseBackoffDuration(
backoffMessage: string
): number | undefined {
const backoffMessageRegex = /action throttled, backoff for ((?:([0-9]+)h)?(?:([0-9]+)m)?([0-9.]+)s)$/;
const backoffMessageRegex =
/action throttled, backoff for ((?:([0-9]+)h)?(?:([0-9]+)m)?([0-9.]+)s)$/;
const [, duration] = backoffMessageRegex.exec(backoffMessage) || [
undefined,
undefined,
Expand Down
18 changes: 0 additions & 18 deletions synth.metadata

This file was deleted.

13 changes: 0 additions & 13 deletions synth.py

This file was deleted.

37 changes: 17 additions & 20 deletions system-test/test-start.ts
Expand Up @@ -45,27 +45,24 @@ before(async () => {
.persist()
.post('/projects/' + process.env.GCLOUD_PROJECT + '/profiles')
.delay(1000)
.reply(
200,
(): RequestProfile => {
let prof;
if (createProfileCount % 2 === 0) {
prof = {
name: 'projects/X/test-projectId',
profileType: 'WALL',
duration: '10s',
};
} else {
prof = {
name: 'projects/X/test-projectId',
profileType: 'HEAP',
duration: '10s',
};
}
createProfileCount++;
return prof;
.reply(200, (): RequestProfile => {
let prof;
if (createProfileCount % 2 === 0) {
prof = {
name: 'projects/X/test-projectId',
profileType: 'WALL',
duration: '10s',
};
} else {
prof = {
name: 'projects/X/test-projectId',
profileType: 'HEAP',
duration: '10s',
};
}
);
createProfileCount++;
return prof;
});
const tempUploadedProfiles = new Array<RequestProfile>();
nock(API)
.persist()
Expand Down
45 changes: 19 additions & 26 deletions test/profiles-for-tests.ts
Expand Up @@ -181,9 +181,8 @@ export const timeProfile: perftools.profiles.IProfile = Object.freeze({

// timeProfile is encoded then decoded to convert numbers to longs, in
// decodedTimeProfile
const encodedTimeProfile = perftools.profiles.Profile.encode(
timeProfile
).finish();
const encodedTimeProfile =
perftools.profiles.Profile.encode(timeProfile).finish();
export const decodedTimeProfile = Object.freeze(
perftools.profiles.Profile.decode(encodedTimeProfile)
);
Expand Down Expand Up @@ -338,9 +337,8 @@ export const heapProfile: perftools.profiles.IProfile = Object.freeze({

// heapProfile is encoded then decoded to convert numbers to longs, in
// decodedHeapProfile
const encodedHeapProfile = perftools.profiles.Profile.encode(
heapProfile
).finish();
const encodedHeapProfile =
perftools.profiles.Profile.encode(heapProfile).finish();
export const decodedHeapProfile = Object.freeze(
perftools.profiles.Profile.decode(encodedHeapProfile)
);
Expand Down Expand Up @@ -394,8 +392,8 @@ const heapLocationsWithExternal = [
new perftools.profiles.Location({line: [heapLinesWithExternal[4]], id: 5}),
];

export const heapProfileWithExternal: perftools.profiles.IProfile = Object.freeze(
{
export const heapProfileWithExternal: perftools.profiles.IProfile =
Object.freeze({
sampleType: [
new perftools.profiles.ValueType({type: 1, unit: 2}),
new perftools.profiles.ValueType({type: 3, unit: 4}),
Expand Down Expand Up @@ -450,8 +448,7 @@ export const heapProfileWithExternal: perftools.profiles.IProfile = Object.freez
timeNanos: 0,
periodType: new perftools.profiles.ValueType({type: 3, unit: 4}),
period: 524288,
}
);
});

// heapProfile is encoded then decoded to convert numbers to longs, in
// decodedHeapProfile
Expand Down Expand Up @@ -496,8 +493,8 @@ const anonymousFunctionHeapLocations = [
}),
];

export const anonymousFunctionHeapProfile: perftools.profiles.IProfile = Object.freeze(
{
export const anonymousFunctionHeapProfile: perftools.profiles.IProfile =
Object.freeze({
sampleType: [
new perftools.profiles.ValueType({type: 1, unit: 2}),
new perftools.profiles.ValueType({type: 3, unit: 4}),
Expand All @@ -523,8 +520,7 @@ export const anonymousFunctionHeapProfile: perftools.profiles.IProfile = Object.
timeNanos: 0,
periodType: new perftools.profiles.ValueType({type: 3, unit: 4}),
period: 524288,
}
);
});

const anonymousFunctionTimeNode = {
scriptName: 'main',
Expand Down Expand Up @@ -569,8 +565,8 @@ const anonymousFunctionTimeLocations = [
}),
];

export const anonymousFunctionTimeProfile: perftools.profiles.IProfile = Object.freeze(
{
export const anonymousFunctionTimeProfile: perftools.profiles.IProfile =
Object.freeze({
sampleType: [
new perftools.profiles.ValueType({type: 1, unit: 2}),
new perftools.profiles.ValueType({type: 3, unit: 4}),
Expand All @@ -597,8 +593,7 @@ export const anonymousFunctionTimeProfile: perftools.profiles.IProfile = Object.
durationNanos: 10 * 1000 * 1000 * 1000,
periodType: new perftools.profiles.ValueType({type: 3, unit: 4}),
period: 1000,
}
);
});

const heapWithPathLeaf1 = {
name: 'foo2',
Expand Down Expand Up @@ -716,8 +711,8 @@ const heapIncludePathLocations = [
}),
];

export const heapProfileIncludePath: perftools.profiles.IProfile = Object.freeze(
{
export const heapProfileIncludePath: perftools.profiles.IProfile =
Object.freeze({
sampleType: [
new perftools.profiles.ValueType({type: 1, unit: 2}),
new perftools.profiles.ValueType({type: 3, unit: 4}),
Expand Down Expand Up @@ -759,8 +754,7 @@ export const heapProfileIncludePath: perftools.profiles.IProfile = Object.freeze
timeNanos: 0,
periodType: new perftools.profiles.ValueType({type: 3, unit: 4}),
period: 524288,
}
);
});

// heapProfile is encoded then decoded to convert numbers to longs, in
// decodedHeapProfile
Expand Down Expand Up @@ -797,8 +791,8 @@ const heapExcludePathLocations = [
}),
];

export const heapProfileExcludePath: perftools.profiles.IProfile = Object.freeze(
{
export const heapProfileExcludePath: perftools.profiles.IProfile =
Object.freeze({
sampleType: [
new perftools.profiles.ValueType({type: 1, unit: 2}),
new perftools.profiles.ValueType({type: 3, unit: 4}),
Expand All @@ -825,8 +819,7 @@ export const heapProfileExcludePath: perftools.profiles.IProfile = Object.freeze
timeNanos: 0,
periodType: new perftools.profiles.ValueType({type: 3, unit: 4}),
period: 524288,
}
);
});

// heapProfile is encoded then decoded to convert numbers to longs, in
// decodedHeapProfile
Expand Down

0 comments on commit 776916e

Please sign in to comment.