-
Notifications
You must be signed in to change notification settings - Fork 218
Add locket client keepalive time and timeout to jobs #722
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
winkingturtle-vmw
merged 3 commits into
cloudfoundry:develop
from
klapkov:locket_client
Apr 24, 2023
Merged
Changes from 2 commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
| source 'https://rubygems.org' | ||
|
|
||
| group :test do | ||
| gem 'bosh-template' | ||
| gem 'rspec' | ||
| gem 'rubocop' | ||
| end | ||
|
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,54 @@ | ||
| GEM | ||
| remote: https://rubygems.org/ | ||
| specs: | ||
| ast (2.4.2) | ||
| bosh-template (2.3.0) | ||
| semi_semantic (~> 1.2.0) | ||
| diff-lcs (1.3) | ||
| json (2.6.2) | ||
| parallel (1.22.1) | ||
| parser (3.1.2.1) | ||
| ast (~> 2.4.1) | ||
| rainbow (3.1.1) | ||
| regexp_parser (2.6.0) | ||
| rexml (3.2.5) | ||
| rspec (3.6.0) | ||
| rspec-core (~> 3.6.0) | ||
| rspec-expectations (~> 3.6.0) | ||
| rspec-mocks (~> 3.6.0) | ||
| rspec-core (3.6.0) | ||
| rspec-support (~> 3.6.0) | ||
| rspec-expectations (3.6.0) | ||
| diff-lcs (>= 1.2.0, < 2.0) | ||
| rspec-support (~> 3.6.0) | ||
| rspec-mocks (3.6.0) | ||
| diff-lcs (>= 1.2.0, < 2.0) | ||
| rspec-support (~> 3.6.0) | ||
| rspec-support (3.6.0) | ||
| rubocop (1.38.0) | ||
| json (~> 2.3) | ||
| parallel (~> 1.10) | ||
| parser (>= 3.1.2.1) | ||
| rainbow (>= 2.2.2, < 4.0) | ||
| regexp_parser (>= 1.8, < 3.0) | ||
| rexml (>= 3.2.5, < 4.0) | ||
| rubocop-ast (>= 1.23.0, < 2.0) | ||
| ruby-progressbar (~> 1.7) | ||
| unicode-display_width (>= 1.4.0, < 3.0) | ||
| rubocop-ast (1.23.0) | ||
| parser (>= 3.1.1.0) | ||
| ruby-progressbar (1.11.0) | ||
| semi_semantic (1.2.0) | ||
| unicode-display_width (2.3.0) | ||
|
|
||
| PLATFORMS | ||
| ruby | ||
|
|
||
| DEPENDENCIES | ||
| bosh-template | ||
| rspec | ||
| rubocop | ||
|
|
||
| BUNDLED WITH | ||
| 2.3.22 | ||
|
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -18,6 +18,7 @@ else | |
| exit 1 | ||
| fi | ||
|
|
||
| ./scripts/run-template-tests-in-docker.sh | ||
|
|
||
| docker run \ | ||
| --rm \ | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,19 @@ | ||
| #!/bin/bash | ||
| set -u | ||
|
|
||
| ROOT_DIR_PATH="$(cd $(dirname $0)/.. && pwd)" | ||
| cd "${ROOT_DIR_PATH}" | ||
|
|
||
| echo "Running template tests" | ||
|
|
||
| docker run \ | ||
| --rm \ | ||
| -it \ | ||
| --privileged \ | ||
| -v "${PWD}:/diego-release" \ | ||
| --cap-add ALL \ | ||
| -w /diego-release \ | ||
| "ruby:3.0" \ | ||
klapkov marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| /diego-release/scripts/template-tests "$@" | ||
|
|
||
| echo "Done executing template tests" | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,9 @@ | ||
| #!/bin/bash -exu | ||
|
|
||
| ROOT_DIR_PATH="$(cd $(dirname $0)/.. && pwd)" | ||
|
|
||
| pushd "${ROOT_DIR_PATH}" > /dev/null | ||
| bundle install | ||
| bundle exec rspec spec | ||
| rubocop spec | ||
| popd > /dev/null |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,65 @@ | ||
| # frozen_string_literal: true | ||
|
|
||
| # rubocop: disable Metrics/BlockLength | ||
| require 'rspec' | ||
| require 'json' | ||
| require 'bosh/template/test' | ||
|
|
||
| describe 'auctioneer' do | ||
| let(:release_path) { File.join(File.dirname(__FILE__), '..') } | ||
| let(:release) { Bosh::Template::Test::ReleaseDir.new(release_path) } | ||
| let(:job) { release.job('auctioneer') } | ||
|
|
||
| describe 'auctioneer.json.erb' do | ||
| let(:deployment_manifest_fragment) do | ||
| { | ||
| 'bpm' => { | ||
| 'enabled' => 'true' | ||
| }, | ||
| 'diego' => { | ||
| 'auctioneer' => { | ||
| 'bbs' => { | ||
| 'ca_cert' => 'CA CERTS', | ||
| 'client_cert' => 'CLIENT CERT', | ||
| 'client_key' => 'CLIENT KEY' | ||
| }, | ||
| 'bin_pack_first_fit_weight' => 0, | ||
| 'ca_cert' => 'CA CERT', | ||
| 'locket' => { | ||
| 'client_keepalive_time' => 10, | ||
| 'client_keepalive_timeout' => 22 | ||
| }, | ||
| 'rep' => { | ||
| 'ca_cert' => 'CA CERT', | ||
| 'client_cert' => 'CLIENT CERT', | ||
| 'client_key' => 'CLIENT KEY', | ||
| 'require_tls' => 'true' | ||
| }, | ||
| 'server_cert' => 'SERVER CERT', | ||
| 'server_key' => 'SERVER KEY', | ||
| 'skip_consul_lock' => 'true' | ||
| } | ||
| }, | ||
| 'enable_consul_service_registration' => 'false', | ||
| 'loggregator' => 'LOGGREGATOR PROPS', | ||
| 'logging' => { | ||
| 'format' => { | ||
| 'timestamp' => 'rfc3339' | ||
| } | ||
| } | ||
| } | ||
| end | ||
|
|
||
| let(:template) { job.template('config/auctioneer.json') } | ||
| let(:rendered_template) { template.render(deployment_manifest_fragment) } | ||
|
|
||
| context 'check if locket keepalive time is bigger than the timeout' do | ||
| it 'fails if the keepalive time is bigger than timeout' do | ||
| deployment_manifest_fragment['diego']['auctioneer']['locket']['client_keepalive_time'] = 23 | ||
| expect do | ||
| rendered_template | ||
| end.to raise_error(/The locket client keepalive time property should not be larger than the timeout/) | ||
| end | ||
| end | ||
| end | ||
| end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,85 @@ | ||
| # frozen_string_literal: true | ||
|
|
||
| # rubocop: disable Metrics/BlockLength | ||
| require 'rspec' | ||
| require 'json' | ||
| require 'bosh/template/test' | ||
|
|
||
| describe 'bbs' do | ||
| let(:release_path) { File.join(File.dirname(__FILE__), '..') } | ||
| let(:release) { Bosh::Template::Test::ReleaseDir.new(release_path) } | ||
| let(:job) { release.job('bbs') } | ||
|
|
||
| describe 'bbs.json.erb' do | ||
| let(:deployment_manifest_fragment) do | ||
| { | ||
| 'bpm' => { | ||
| 'enabled' => 'true' | ||
| }, | ||
| 'diego' => { | ||
| 'bbs' => { | ||
| 'active_key_label' => 'ACTIVE KEY', | ||
| 'detect_consul_cell_registrations' => 'false', | ||
| 'encryption_keys' => [ | ||
| 'label' => 'KEY LABEL', | ||
| 'passphrase' => 'PASSPHRASE' | ||
| ], | ||
| 'sql' => { | ||
| 'db_host' => 'sql-db.service.cf.internal', | ||
| 'db_port' => 3306, | ||
| 'db_schema' => 'diego', | ||
| 'db_username' => 'diego', | ||
| 'db_password' => 'DB PASSWORD', | ||
| 'db_driver' => 'mysql', | ||
| 'ca_cert' => 'CA CERT', | ||
| 'require_ssl' => true | ||
| }, | ||
| 'ca_cert' => 'CA CERT', | ||
| 'auctioneer' => { | ||
| 'ca_cert' => 'CA CERT', | ||
| 'client_cert' => 'CLIENT CERT', | ||
| 'client_key' => 'CLIENT KEY' | ||
| }, | ||
| 'locket' => { | ||
| 'client_keepalive_time' => 10, | ||
| 'client_keepalive_timeout' => 22 | ||
| }, | ||
| 'server_cert' => 'SERVER CERT', | ||
| 'server_key' => 'SERVER KEY', | ||
| 'skip_consul_lock' => 'true', | ||
| 'rep' => { | ||
| 'require_tls' => 'true', | ||
| 'ca_cert' => 'CA CERT', | ||
| 'client_cert' => 'CLIENT CERT', | ||
| 'client_key' => 'CLIENT KEY' | ||
| } | ||
| }, | ||
| 'enable_consul_service_registration' => 'false', | ||
| 'loggregator' => { | ||
| 'use_v2_api' => 'true', | ||
| 'ca_cert' => 'CA CERT', | ||
| 'client_cert' => 'CLIENT CERT', | ||
| 'client_key' => 'CLIENT KEY' | ||
| }, | ||
| 'logging' => { | ||
| 'format' => { | ||
| 'timestamp' => 'rfc3339' | ||
| } | ||
| } | ||
| } | ||
| } | ||
| end | ||
|
|
||
| let(:template) { job.template('config/bbs.json') } | ||
| let(:rendered_template) { template.render(deployment_manifest_fragment) } | ||
|
|
||
| context 'check if locket keepalive time is bigger than the timeout' do | ||
| it 'fails if the keepalive time is bigger than timeout' do | ||
| deployment_manifest_fragment['diego']['bbs']['locket']['client_keepalive_time'] = 23 | ||
| expect do | ||
| rendered_template | ||
| end.to raise_error(/The locket client keepalive time property should not be larger than the timeout/) | ||
| end | ||
| end | ||
| end | ||
| end |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.
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.
Traditionally the
docker-shellscript has been for just getting into a shell to do various one-off tests, and not actually test anything. Can you remove this call? If we want something to do all the testing, maybe instead add a run-all-tests-in-docker script that calls both run-template-tests-in-docker.sh + docker-test scripts.Uh oh!
There was an error while loading. Please reload this page.
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.
Sounds reasonable, please check the new commit.