Comments (7)
Hi @NBJS . Thank you for your report.
If you set subnet_id (not Name
tag) as expected_subnet
, you can test faster.
( Because no loop )
( In order to avoid tag duplication, ) If you set Name
tag as expected_subnet
, awspec has to check all subnets by using describe_subnets
Regards.
from awspec.
Hi @k1LoW , thanks for your response.
I have tested with subnet_ids and although it is quicker than using the name tag, it still takes a long time. This time instead of 8 minutes it took 3 minutes.
from awspec.
Are we still looking for to improve this?
I did some bench marking using a local cache from describe_subnets
response without filters and looks promising:
$ ruby test.rb
user system total real
find_by_sub 0.051339 0.000343 0.051682 ( 2.181745)
find2_by_sub 0.061501 0.000098 0.061599 ( 1.143955)
find_by_cidr 0.057556 0.000000 0.057556 ( 3.300872)
find2_by_cidr 0.053146 0.003496 0.056642 ( 1.287103)
find_by_tag 0.021081 0.000089 0.021170 ( 1.080978)
find2_by_tag 0.026609 0.000000 0.026609 ( 0.584046)
where find_*
refers to the original Finder::Subnet::find_subnet
and find2_*
refers to the function below:
def find_subnet2(subnet_id)
res = $ec2_client.describe_subnets
by_tag_name = {}
by_cidr = {}
subnet_ids = []
res.subnets.each do |sub|
by_cidr[sub.cidr_block.to_sym] = sub.subnet_id
next if sub.tags.empty?
sub.tags.each do |tag|
if tag[:key].eql?('Name')
by_tag_name[tag[:value].to_sym] = sub.subnet_id
break
end
end
subnet_ids.append(sub.subnet_id)
end
by_subinet_ids = Set.new(subnet_ids)
if subnet_id.start_with?('subnet-')
return subnet_id if by_subinet_ids.include?(subnet_id)
end
id_key = subnet_id.to_sym
if $ip_matcher.match(subnet_id)
return by_cidr[id_key] if by_cidr.key?(id_key)
else
return by_tag_name[id_key]
end
end
Of course, we should keep the cache for the whole testing session, but that's another thing to try to implement.
from awspec.
@NBJS , I did a PR for that, could you please give it a try?
from awspec.
@k1LoW , I'm afraid the original requestor is out of reach... could you please take a look at PR #538 ?
from awspec.
@k1LoW , since PR was accepted, I think we can close this issue.
from awspec.
from awspec.
Related Issues (20)
- API Gateway tests fail if more than 25 APIs in Gateway even though APIs exist HOT 2
- Cannot do a negative test for security groups HOT 4
- The format of stub files HOT 1
- Support for using have_record_set for a cname record that point to multiple weighted targets HOT 1
- Apigateway resource, probable bug in https://github.com/k1LoW/awspec/blob/master/lib/awspec/type/apigateway.rb#L34 HOT 1
- Add support for S3 bucket location
- Networkissue when using Proxy HOT 2
- rds_parameter_group parameter check fails with 'method_missing' HOT 3
- route53_hosted_zone parameter check fails with 'no implicit conversion of Hash into String' HOT 1
- Documentation for eks_nodegroup is not working properly
- Filter tests (Run chosen tests only) HOT 1
- several warnings during testing
- Subnet finder missing by_cidr method HOT 1
- Missing details for iam_role and iam_policy
- cannot install due missing aws-sdk-core version
- Error requiring awspec when using Ruby 3.1.0 HOT 2
- Does awspec support RDS Aurora? HOT 2
- Error executing request, Exception : ComputeEnvironments and MaxResults cannot both be set
- aws_sfn_state_machine not exists HOT 1
- An error occurred while loading ./spec/ec2_spec.rb. - Did you mean? rspec ./spec/spec_helper.rbFailure/Error: require 'awspec'
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from awspec.