-
Notifications
You must be signed in to change notification settings - Fork 113
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I went through and found our API's comparable methods to the SDK calls.
system-test/compute.js
Outdated
after(async () => { | ||
const [firewalls] = await compute.getFirewalls(); | ||
const firewallsToDelete = firewalls | ||
.filter(x => x.name.includes('network-name')) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
.filter(x => x.name.includes('network-name')) | |
.filter(x => x.name.startsWith(TESTS_PREFIX)) |
system-test/compute.js
Outdated
.filter(x => x.name.includes('network-name')) | ||
.map(y => y.name); | ||
for (const firewall of firewallsToDelete) { | ||
await deleteFirewallRule(firewall); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would the method firewall.delete()
work? (You'd have to remove the .map(y => y.name)
part above)
system-test/compute.js
Outdated
execSync( | ||
`gcloud compute networks create ${NETWORK_NAME} --subnet-mode=custom` | ||
); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
execSync( | |
`gcloud compute networks create ${NETWORK_NAME} --subnet-mode=custom` | |
); | |
const [network, operation] = await compute.createNetwork(NETWORK_NAME, {autoCreateSubnetworks: false}); | |
await operation.promise(); |
^ I'm not sure that's equivalent. Just a guess from the docs: 'When set to true, the VPC network is created in auto mode. When set to false, the VPC network is created in custom mode.'
system-test/compute.js
Outdated
execSync( | ||
`gcloud compute networks subnets create ${SUBNETWORK_NAME} --network=${NETWORK_NAME} --range=10.0.1.0/24 --region=us-central1` | ||
); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
execSync( | |
`gcloud compute networks subnets create ${SUBNETWORK_NAME} --network=${NETWORK_NAME} --range=10.0.1.0/24 --region=us-central1` | |
); | |
const [subnetwork, operation] = await network.createSubnetwork(SUBNETWORK_NAME, { | |
region: 'us-central1', | |
range: '10.0.1.0/24' | |
}); | |
await operation.promise(); |
system-test/compute.js
Outdated
execSync( | ||
`gcloud compute backend-services create ${BACKEND_SERVICE_NAME} --load-balancing-scheme=INTERNAL --region=us-central1` | ||
); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
execSync( | |
`gcloud compute backend-services create ${BACKEND_SERVICE_NAME} --load-balancing-scheme=INTERNAL --region=us-central1` | |
); | |
await computeRequest({ | |
method: 'POST', | |
uri: '/regions/us-central1/backendServices', | |
json: { | |
name: BACKEND_SERVICE_NAME, | |
loadBalancingScheme: 'INTERNAL', | |
}, | |
}); |
system-test/compute.js
Outdated
execSync( | ||
`gcloud compute forwarding-rules create ${RULE_NAME} --load-balancing-scheme=INTERNAL --backend-service=${BACKEND_SERVICE_NAME} --subnet=${SUBNETWORK_NAME} --network=${NETWORK_NAME} --region=us-central1 --ports=80-82` | ||
); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
execSync( | |
`gcloud compute forwarding-rules create ${RULE_NAME} --load-balancing-scheme=INTERNAL --backend-service=${BACKEND_SERVICE_NAME} --subnet=${SUBNETWORK_NAME} --network=${NETWORK_NAME} --region=us-central1 --ports=80-82` | |
); | |
const region = compute.region('us-central1'); | |
const [rule, operation] = region.createRule(RULE_NAME, { | |
loadBalancingScheme: 'INTERNAL', | |
backendService: BACKEND_SERVICE_NAME, | |
subnetwork: SUBNETWORK_NAME, | |
network: NETWORK_NAME, | |
ports: ['80', '81', '82'], | |
}); | |
await operation.promise(); |
system-test/compute.js
Outdated
} | ||
await deleteForwardingRules(RULE_NAME); | ||
await deleteBackendService(BACKEND_SERVICE_NAME); | ||
await deleteSubnetworks(SUBNETWORK_NAME); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
await deleteSubnetworks(SUBNETWORK_NAME); | |
const [operation] = await subnetwork.delete(); | |
await operation.promise(); |
system-test/compute.js
Outdated
for (const firewall of firewallsToDelete) { | ||
await deleteFirewallRule(firewall); | ||
} | ||
await deleteForwardingRules(RULE_NAME); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
await deleteForwardingRules(RULE_NAME); | |
const [operation] = await rule.delete(); | |
await operation.promise(): |
Co-authored-by: Stephen <[email protected]>
Codecov Report
@@ Coverage Diff @@
## master #522 +/- ##
=======================================
Coverage 99.61% 99.61%
=======================================
Files 22 22
Lines 11949 11949
=======================================
Hits 11903 11903
Misses 46 46 Continue to review full report at Codecov.
|
@stephenplusplus, I keep getting this error when changing the methods to using the API, which I was getting before I just decided to use the CLI 🙂
When I try to add the full URI (projects/projectId etc), I get this error:
Do you know how the name should actually be formed? |
@sofisl I ran into similar issues, but I think I was able to get the formatting correct. Here's a diff of what I tried: https://gist.github.com/stephenplusplus/87b66993a0627e114dc296bf6ea132f5 |
…is/nodejs-compute into skipExternalForwardingRuleTests
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍 contingent on dropping the gaxios
dependency.
package.json
Outdated
@@ -57,6 +57,7 @@ | |||
"c8": "^7.0.0", | |||
"codecov": "^3.0.2", | |||
"concat-stream": "^2.0.0", | |||
"gaxios": "^4.0.1", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we can drop this.
Merge-on-green attempted to merge your PR for 6 hours, but it was not mergeable because either one of your required status checks failed, one of your required reviews was not approved, or there is a do not merge label. Learn more about your required status checks here: https://help.github.com/en/github/administering-a-repository/enabling-required-status-checks. You can remove and reapply the label to re-run the bot. |
Fixes #520
This test is currently failing because we are attempting to create an external forwarding rule, which I believe gce enforcer is blocking. So, I've tried refactoring the code so that we create an internal forwarding rule and test that.
I tried many different ways of setting up this rule, including following the how-to guides here. I could not get them to work. The only way I was successful was by using the CLI, even after trying to convert the CLI commands into REST API.
I know this is not the ideal solution, but I've got nothing better. Would love to get a second pair of eyes on this if possible.