feat: implement the driver api version, plugin version, status, and doctor hooks - #138
Merged
Conversation
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
This driver implemented none of the optional plugin hooks. It now implements all four.
kitchen_driver_api_version 2andplugin_versionkitchen diagnosereportedversion: nilfor the driver before this, so a bug report never said which kitchen-digitalocean produced it.#statusAsks the API what state the Droplet is actually in, so
kitchen listcan report it rather than inferring from the state file. Falls back to the base "unknown" answer when there is no Droplet in state, the id is gone, or the API cannot be reached —kitchen listshould not raise.#doctorTwo checks, both reachable:
ssh_key_idsis set but empty, which builds a Droplet with no key installed and a transport that cannot log inI dropped a third check I had written for a missing access token:
required_config :digitalocean_access_tokenalready rejects nil and empty string duringfinalize_config!, sodoctorcan never see one. Duplicating it would have been unreachable code that looked like coverage.One trap worth flagging
The first version of
#token_problemsused a barerescue StandardErrorand caught nothing. Test Kitchen defines its ownKitchen::StandardError < ::StandardError, and insidemodule Kitchen; module Driverthe bare constant resolves lexically toKitchen::StandardError— so the rescue silently narrows to Test Kitchen's own errors and a real::StandardErrorsails straight through.The leading
::is load bearing. I checked the other twenty kitchen-* repos for the same pattern; none of them have it.Verification
rake test— 175 examples, 0 failures (164 before; 11 new)cookstyle --chefstyle— 5 files, no offensesyard stats— 21 methods, 0 undocumented, 100%