Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save snehitgajjar/d8b3c912275ac05499afefd091658d9b to your computer and use it in GitHub Desktop.
Save snehitgajjar/d8b3c912275ac05499afefd091658d9b to your computer and use it in GitHub Desktop.
sg045734@M1600382  ~/Desktop/code/knife-ets-release   dev ●  rspec
KnifePlugins::EtsReleaseAnnouncement
#run
calls the correct methods
#setup
jira issue not provided
raises an error
no tags on repo
raises an error
#repository
returns an Octokit repository object
#repo
returns a GitHub repo string
#tags
returns an array of the tags
first tag is being released
returns an array with only the first tag
#release_tag_index
returns 0 by default
config option provided
returns index of release tag in array of tags
#previous_tag_index
release tag config option provided
returns index of tag previous to release index by default
previous tag config option provided
returns index of release tag in array of tags
previous tag provided is not older than release tag
raises an error
#find_tag
raises an error if the tag name can't be found
#release_version
returns the latest tag with no preceding 'v'
#comp_shas
returns the comparison SHAs from the commits
#committers(pull)
returns uniq'd hash definition of committers on pull
#contributors(pull)
returns a uniq'd array of user logins that commented on the pull
#pulls
returns an array of hash definitions of pulls to render in the html
#template
returns the template html string to render
#ucern_content_html
returns rendered html
returns escaped, valid html
#title
returns the title for the post
#jira_project
returns the JIRA project key based on the issue provided
#ucern_site
returns a rest client resource
#test_ucern
does nothing if ucern api returns a 2XX response
#parse_ucern_response(resp)
returns a hash from the parsed ucern JSON response
#ucern_place
returns a hash definition of the ucern place to post to
the provided place name is duplicated in uCern
Chef::Knife::UI
WARNING: Could not reliably determine uCern place with name: 'fake place name'. Content will not be posted in a place, move content manually after creation.
returns nil
#content_payload
returns the JSON to POST to the uCern api
#post_ucern_content
POSTs content payload to html
KnifePlugins::EtsReleaseCheck
#http_object
returns the @http_object instance variable
when @http_object is nil
assigns it a new Net::HTTP object
when the URI uses https
sets the use_ssl option to true
when the URI does not use https
sets the use_ssl option to false
#do_request
when the response code does not indicate success
raises an error
when the response is a redirect
retries the request five times
when the response code indicates success
when is_post is set to true
creates a POST request
when is_post is set to false or nil
creates a GET request
when the response does not have a next field
returns the message body
when the response has a next field
apppends a new body to the returned message
#get_next_path
when the response does not have a Link field
returns nil
when the response has a Link field
returns the uri found in the Link field
#run_command
returns command output
when the command is unsuccessful
when parameter error_ok is set to true
sets the output to an empty string
when error_ok parameter is not true
raises an error
#run_for_repo
when the repo info is correct
when the repo has a tag
sets the tagged property to true
when the repo does not have a tag
sets the tagged property to false
when the repo dev branch is merged
sets the dev_merged property to true
when the repo dev branch is not merged
sets the dev_merged property to false
when there are open pull requests
sets the pulls property to an array of their titles
when there are no open pull requests
sets the pulls property to an array of their titles
when the repo info is incorrect
will raise a RuntimeError
#run
prints out the status report
when a repo is listed in 'config[:exclude_name]'
is not added to the @repos instance variable
when a repo is listed in 'config[:name]'
only lists that repo
KnifePlugins::EtsReleaseJira
#create_parent
when @issue_name is nil
creates a new issue and returns the issue_name
sets the @issue_name instance variable
sets the @issue_id instance variable
when @issue_name is not nil
returns @issue_name
#find_jira_info
sets the @issue_name instance variable
sets the @issue_id instance variable
#create_subtask
appends the jira_key to the @subtasks instance variable
#create_jira
when the @component_id instance variable is nil
raises an invalid component error
when the @component_id instance variable is not nil
calls create_subtask for each item in @subtasks_desc
when instance variables are being set
assigns value to @project_meta
assigns to @component_id
assigns new array to @subtasks
assigns hardcoded array to @subtasks_desc
when the @jira_key instance variable is nil
calls the create_parent method
when the @jira_key instance variable is not nil
calls the find_jira_info method
#vault_item
returns the @vault_item instance variable
when the @vault_item instance variable is nil
assigns ChefVault item to @vault_item instance variable
#pull_to_master
when pull request to master is created succesfully
https://github.cerner.com/ETS/knife-ets-release/pull/23
returns nil
prints github url
when issue while pull request creation
Unauthorized user
returns nil
prints error message
#run
when the project is not set in the config
raises an error
when the release version is not set in the config
raises an error
when there are no runtime errors
calls the create_jira method
when setting instance variables
sets @jira_priority
sets @jira_issuetype
sets @project
sets @jira_url
sets @jira_project
sets @jira_key
sets @release_version
when the jira_component is nil
sets @component_name to the project name
when the jira_component is not nil
sets @component_name to the jira_component
#<KnifePlugins::EtsReleaseTtp:0x007f9369d452e8>
#http_request
when request is submitted successfully
returns response object
when host name is incorrect
raises SocketError
when request is incorrect
raises SocketError
when nil req_type is passed
returns nil
#add_label
when ttp label is created & added successfully
returns string message
when incorrect document id is passed
raises StandardError
Git::GitWrapper
#initialize
when new object of GitWrapper is crete with no url
uses default api url
sets instance variable @client
when new object of GitWrapper is crete with url
uses default api url
#create_pr
when pull request is created successful
returns html url for created pull request
when pull request is not created successful
returns detailed error message
when unauthorized error occurs in octokit
returns error message
when other errors occur in octokit
returns error message
Finished in 5.26 seconds (files took 1.13 seconds to load)
101 examples, 0 failures
Coverage report generated for RSpec to /Users/sg045734/Desktop/code/knife-ets-release/coverage. 858 / 901 LOC (95.23%) covered.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment