facebook / taste-tester Goto Github PK
View Code? Open in Web Editor NEWSoftware to manage a chef-zero instance and use it to test changes on production servers.
License: Apache License 2.0
Software to manage a chef-zero instance and use it to test changes on production servers.
License: Apache License 2.0
taste-tester will build a knife config file to point at the local chef-zero instance in ~/.chef/ . If multiple instances of taste-tester are invoked and the home directories are on shared storage you can have conflicts. Possible easy fix is to change the config file name to include the local hostname (considering it's already writing that into said file anyways).
Otherwise, any in-flight test will fail.
It's really not hard to do, we just need to keep the port instead of wiping the entire config...
taste-tester/lib/taste_tester/client.rb
Line 162 in 9603cf3
This is something I never resolved. It's not actually having any immediate effect, so fixing it is pretty academic. I think the best path forward is to actually depend on the minimum version of minitar directly in this project so we guarantee we get better behaviour.
When using master, the following error is thrown upon upload:
/opt/tastetester/bin/taste-tester upload -vvv
Using /Users/nate/chef
Trying to detect repo type
Repo found to be Git
Last commit: a82e9d2e13252b225fcb10c8c5e720f3be82104e 's' by [email protected]
Doing differential upload from a82e9d2e13252b225fcb10c8c5e720f3be82104e
Running "git diff --name-status a82e9d2e13252b225fcb10c8c5e720f3be82104e "
Nothing to upload!
Executed in 0.04s
Traceback (most recent call last):
3: from /opt/tastetester/bin/taste-tester:32:in `<main>'
2: from /opt/tastetester/bin/taste-tester:427:in `<module:TasteTester>'
1: from /opt/tastetester/bin/taste-tester:427:in `include'
/opt/tastetester/bin/taste-tester:427:in `append_features': cyclic include detected (ArgumentError)
Per https://github.com/chef/chef/blob/61a11902ab814aad3625eb4da7e3345d63ee7c09/knife/lib/chef/knife/data_bag_from_file.rb#L64, the local folder should be called data_bags
.
However, here we are uploading it as databag
:
taste-tester/lib/taste_tester/client.rb
Lines 200 to 203 in aac2f8c
This causes fetching databags with the library to fail: https://github.com/chef/chef/blob/61a11902ab814aad3625eb4da7e3345d63ee7c09/lib/chef/data_bag.rb#L140
Is there any chance someone can upload a plugin sample? This repo is just different enough from chefctl that I'm configuring something incorrectly.
This is what I'm attempting to add as a plugin.
module TasteTesterCustom
def test_remote_client_rb_extra_code(_hostname)
# Append to client.rb
return "json_attribs '/etc/chef/run-list.json'"
end
end
TasteTester::Hooks.register TasteTesterCustom
Thanks!
The 'kill' command to kill chefctls that taste-tester sends has an extra space in it, when used with tunnels:
kill -- - 2341
which doesn't work.
If the server we're testing against has a banner enabled (Banner
option in sshd_config
), taste-tester
will print it to stdout at the very beginning (before Taste-tester type:
). Not a big deal, but we should probably silence this by default.
When taste-tester upload
calls knife
and knife
finds a syntax error on a file in a cookbook it doesn't tell you what cookbook or what file. To debug you have to take the knife
command from the output and then run it with -VV
which is a bit cumbersome.
I'll probably send a PR for this, I'm just making the Issue so I don't forget.
... because that help is printed before the config is read in.
There's a lot of repeated code here. The worst offenders got factored into ssh_util.rb, but still they should all be one module and just take an option for tunnel (which ssh.rb
already does, but ignores).
Specifying a repo in the config requires everyone in an organization to use the same path to their chef repo.
At facebook it standard to symlink ~/chef etc. to wherever you check it out, but this isn't all that common elsewhere.
Instead it makes sense to see if we're in a repo and use the current repo if a repo isn't specified.
TT calculates what the test-timestamp should be on the local machine and then passes the result through to the remote machine in a literal format.
If the remote machine is in a timezone more than an hour ahead, then the host will immediately be un-taste-tested.
I attempted to launch taste-tester with the --chef-port-range argument, but it appeared to ignore my specified port entirely. It turns out it was reading the port from the taste-tester-ref.json file in the chef-cache directory, which presumably came from the previous taste-tester run.
I would expect the command line to override the old json file.
This is sad:
Loading plugin at /home/phil/src/git/scale-chef/taste-tester-plugin.rb
Starting taste-tester server
Using /home/phil/src/git/scale-chef
Failed detecting repo type at /home/phil/src/git/scale-chef
The repo is a sapling repo.
Per the discussion in #144, this shouldn't be necessary anymore
I just ran into this stacktrace when testing on macOS
I thought I'd report it since we should probably never end up in this "undefined local variable or method" situation:
DEBUG: Executing: USER=kickstart /opt/chefdk/embedded/bin/taste-tester test -vv -m server.x.y.com:5376 --transport locallink --linkonly --really -s localhost -y -p /opt/facebook/ops/scripts/chef/taste-tester-hooks.rb -t 1d
DEBUG: ERR: /opt/chefdk/embedded/lib/ruby/gems/2.4.0/gems/taste_tester-0.0.13/lib/taste_tester/state.rb:39:in `rescue in initialize':
DEBUG: ERR: undefined local variable or method `logger' for #<TasteTester::State:0x00007f9589b20658> (NameError)
DEBUG: ERR: Did you mean? @@logger
DEBUG: ERR: from /opt/chefdk/embedded/lib/ruby/gems/2.4.0/gems/taste_tester-0.0.13/lib/taste_tester/state.rb:36:in `initialize'
DEBUG: ERR: from /opt/chefdk/embedded/lib/ruby/gems/2.4.0/gems/taste_tester-0.0.13/lib/taste_tester/server.rb:36:in `new'
DEBUG: ERR: from /opt/chefdk/embedded/lib/ruby/gems/2.4.0/gems/taste_tester-0.0.13/lib/taste_tester/server.rb:36:in `initialize'
DEBUG: ERR: from /opt/chefdk/embedded/lib/ruby/gems/2.4.0/gems/taste_tester-0.0.13/lib/taste_tester/commands.rb:80:in `new'
DEBUG: ERR: from /opt/chefdk/embedded/lib/ruby/gems/2.4.0/gems/taste_tester-0.0.13/lib/taste_tester/commands.rb:80:in `test'
DEBUG: ERR: from /opt/chefdk/embedded/lib/ruby/gems/2.4.0/gems/taste_tester-0.0.13/bin/taste-tester:400:in `<module:TasteTester>'
DEBUG: ERR: from /opt/chefdk/embedded/lib/ruby/gems/2.4.0/gems/taste_tester-0.0.13/bin/taste-tester:32:in `<top (required)>'
DEBUG: ERR: from /opt/chefdk/embedded/bin/taste-tester:23:in `load'
DEBUG: ERR: from /opt/chefdk/embedded/bin/taste-tester:23:in `<main>'
DEBUG: OUT: Loading plugin at /opt/facebook/ops/scripts/chef/taste-tester-hooks.rb
DEBUG: OUT: Skipping upload at user request... potentially dangerous!
The SSH Util code deals with building a vanilla ssh command for logging into a host, where the user gets to customize the command options using hooks:
taste-tester/lib/taste_tester/ssh_util.rb
Lines 19 to 23 in 60e4f6c
The building blocks of this vanilla ssh command could be generated out of a "config specific" command which is more user-friendly for the context for which the config is made. Example custom config:
ssh_cmd_prefix = Mixlib::ShellOut.new("ssh_cmd_prefix generator command").run_command.stdout.chomp
ssh_command ssh_cmd_prefix
When a taste-tester test run fails because of ssh authentication failing, it spews out the vanilla command directly:
taste-tester/lib/taste_tester/ssh_util.rb
Lines 31 to 41 in 60e4f6c
This might be vastly different from the actual custom command ("ssh_cmd_prefix generator command") the owner of the config might want to display during the failure so the developer running taste-tester has a command to run directly to validate the ssh connection first.
There is no place in taste-tester code to customize this behavior. An idea here was to try this in post_test hook but that doesn't fire when there is an ssh failure.
Hence what we need here is some sort of mechanism, hook or just a simple config variable - which can be configured to display the appropriate "ssh_cmd_prefix generator command".
Like the vanilla command does:
taste-tester/lib/taste_tester/ssh_util.rb
Line 60 in aac2f8c
This makes taste-tester tunnel break when use_ssh_tunnel is set to True. It also takes forever to test.
Might have to think about what stance we are taking here, either:
the state file gets the same key in it twice, sometimes;
{"port":5257,"ssl":false,"ssh":true,"logging":true,"ref":null,"ref":"426f245cc96aeaf4ef2aa8c274294db91566417c"}
Note 'ref' is there twice... in my case I think this is one of 2 problems causing tt to restart itself all the time.
I had already reported this in #156 , but we were on an ancient taste-tester version.
Now we upgraded and it turns out: still an issue.
It seems to be failing to call 'logger' when the initialize method tanks:
https://github.com/facebook/taste-tester/blob/master/lib/taste_tester/state.rb#L38
DEBUG: ERR: /opt/chefdk/embedded/lib/ruby/gems/2.5.0/gems/taste_tester-0.0.19/lib/taste_tester/state.rb:38:in `rescue in initialize': undefined local variable or method `logger' for #<TasteTester::State:0x00007fac3644cfc0> (NameError)
DEBUG: ERR: Did you mean? @@logger
DEBUG: ERR: from /opt/chefdk/embedded/lib/ruby/gems/2.5.0/gems/taste_tester-0.0.19/lib/taste_tester/state.rb:35:in `initialize'
DEBUG: ERR: from /opt/chefdk/embedded/lib/ruby/gems/2.5.0/gems/taste_tester-0.0.19/lib/taste_tester/server.rb:35:in `new'
DEBUG: ERR: from /opt/chefdk/embedded/lib/ruby/gems/2.5.0/gems/taste_tester-0.0.19/lib/taste_tester/server.rb:35:in `initialize'
DEBUG: ERR: from /opt/chefdk/embedded/lib/ruby/gems/2.5.0/gems/taste_tester-0.0.19/lib/taste_tester/commands.rb:85:in `new'
DEBUG: ERR: from /opt/chefdk/embedded/lib/ruby/gems/2.5.0/gems/taste_tester-0.0.19/lib/taste_tester/commands.rb:85:in `test'
DEBUG: ERR: from /opt/chefdk/embedded/lib/ruby/gems/2.5.0/gems/taste_tester-0.0.19/bin/taste-tester:450:in `<module:TasteTester>'
DEBUG: ERR: from /opt/chefdk/embedded/lib/ruby/gems/2.5.0/gems/taste_tester-0.0.19/bin/taste-tester:32:in `<top (required)>'
DEBUG: ERR: from /opt/chefdk/embedded/bin/taste-tester:23:in `load'
DEBUG: ERR: from /opt/chefdk/embedded/bin/taste-tester:23:in `<main>'
I think the problem is that the ref_file it tries to create by default is:
ref_file "#{ENV['HOME']}/.chef/taste-tester-ref.json"
and since we run this on macs as part of a launch daemon, "HOME" is not set.
So it fails, tries to log, can't. I think it might have to do with the order of events from 'initialize a class" and "execute the inheritance / extend code".
I guess the right thing would be:
As to why we never noticed: up until recently, our root volume was writable. so writing to /.chef/ was not an issue. As of Big Sur, the root volume is mounted read only.
/cc @ttmgraham since he ran into this
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.