testapi

package
v0.29.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 12, 2024 License: Apache-2.0 Imports: 13 Imported by: 1

README

Examples for using the api

Coded samples

The cmd directory has examples of using the client code to exercise the chef api end points. The bin directory has commands for invoking the code. The inspec directory has inspec tests to verify the output from invoking the code. The chefapi_examples cookbook creates a chef server instance. Test kitchen can run the sample code and verify the resulting output using inspec tests.

Cookbook and kitchen testing

Run kitchen converge to create a chef server instance in a linux image running under vagrant. Run kitchen verify to run the go examples using the client api and to confirm that the results are as expected.

Looking at the output from an api call

Sometimes you might want to see what output gets created by an api call. Inspec tends to hide and mask the output. You can use kitchen login to access the linux image. Use "cd /go/src/testapi/bin" to access the bin directory and run any of the commands to run the api sample use code and see the results. Running the bin commands by adding the -tags debug option will show more detail.

Creating a client

On the test image /go/src/github.com/go-chef/chef/testapi/testapi.go has code that creates a client for use by other api calls. For the purposes of testing it uses the pivotal user and key for all the tests.

Documentation

Overview

Test the go-chef/chef chef server api ACL endpoints against a live server

Test the go-chef/chef chef server api /organization/:org/user and /organization/:org/association_requests endpoints against a live server

Test the go-chef/chef chef server api /organization/:org/user and /organization/:org/association_requests endpoints against a live server

Test the go-chef/chef chef server api /organization/:org/user and /organization/:org/association_requests endpoints against a live server

Test the go-chef/chef chef authenticate_user api endpoint against a live server

Test the go-chef/chef chef server api /clients/CLIENTNAME/keys endpoints against a live chef server

Test the go-chef/chef chef server api /organizations/*/cookbooks endpoints against a live chef server

Test the go-chef/chef chef server api /databag endpoints against a live server

TODO: add users and then add them to groups. Seems to fail. pivotal is maybe not a good test. adding fails silently

Test the go-chef/chef chef server api /license endpoints against a live server

Test the go-chef/chef chef server api /organizations endpoints against a live server

Test the go-chef/chef chef server api /policies endpoints against a live server

Test the go-chef/chef chef server api /policy_groups endpoints against a live server

Test the go-chef/chef chef server api /required_recipe endpoint against a live server

Test the go-chef/chef chef server api /role endpoints against a live server

Test the go-chef/chef chef server api /stats endpoint against a live server

Test the go-chef/chef chef server api /_status endpoints against a live server

Test the go-chef/chef chef server api /organizations endpoints against a live server

Test the go-chef/chef chef server api /universe endpoints against a live server

Test the go-chef/chef chef server api /users endpoints against a live chef server

Test the go-chef/chef chef server api /users/USERNAME/keys endpoints against a live chef server

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ACL added in v0.28.4

func ACL()

ACL exercise the chef server api

func ApiClient

func ApiClient()

client test the chef api

func Association

func Association()

association exercise the chef server api

func AssociationCleanup

func AssociationCleanup()

association_cleanup exercise the chef server api

func AssociationSetup

func AssociationSetup()

association_setup exercise the chef server api

func Authenticate

func Authenticate()

authenticate exercise the chef server api

func Client

func Client() *chef.Client

client exercise the chef server api

func Clientkey

func Clientkey()

clientkey exercise the chef server api

func Container added in v0.17.0

func Container()

container exercise the chef api

func Cookbook

func Cookbook()

cookbook exercise the chef server api

func Databag

func Databag()

databog exercise the chef server api

func Environment

func Environment()

environment exercise the chef api

func Group

func Group()

group exercise the chef server api

func License

func License()

license exercise the chef server api

func Node

func Node()

node exercise the chef api

func Organization

func Organization()

organization exercise the chef server api

func Policy added in v0.19.0

func Policy()

policy exercise the chef server api

func PolicyGroup added in v0.19.0

func PolicyGroup()

policy exercise the chef server api

func Principals added in v0.17.0

func Principals()

principle test the chef api

func PrincipalsAdd added in v0.17.0

func PrincipalsAdd()

principle test the chef api

func PrincipalsDel added in v0.17.0

func PrincipalsDel()

principle test the chef api

func RequiredRecipe added in v0.17.1

func RequiredRecipe()

required_recipe exercise the chef server api

func Role

func Role()

role exercise the chef server api

func Sandbox

func Sandbox()

sandbox exercise the chef api

func Search()

search exercise the chef api

func SearchPagination

func SearchPagination()

search _pagination exercise the chef api

func Stats added in v0.18.0

func Stats()

stats exercise the chef server api

func Status

func Status()

status exercise the chef server api

func Universe

func Universe()

universe exercise the chef server api

func User

func User()

User exercise the chef server api

func Userkey

func Userkey()

userkey exercise the chef server api

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL