Documentation ¶
Overview ¶
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Index ¶
- Constants
- Variables
- func Execute(internalFS fs.FS)
- func FirstLower(s string) string
- func FirstUpper(s string) string
- func NewGenerator(pkgName string, source string, destination string, ...) *generator
- type Command
- type DockerComposefile
- type Dockerfile
- type Handler
- type OutputType
- type Project
- type Repo
- type Service
Constants ¶
const ( TEST_PATH = "test_path" OUTPUT_TYPE = "output" REPORT_PATH = "report_path" VERBOSE = "verbose" RACE = "race" )
flag names
const ( DEFAULT_TEST_PATH = "./..." DEFAULT_OUTPUT_TYPE = string(CLI) DEFAULT_REPORT_PATH = "./report" DEFAULT_VERBOSE = false DEFAULT_RACE = false )
DEFAULT_XXX is used for default values of flags
const ( RLT_PASS result = "PASS" RLT_FAIL result = "FAIL" RLT_SKIP result = "SKIP" RLT_UNKNOWN result = "Unknown" // could be set if test is terminated for some reason before executing it )
const ( START action = "start" RUN action = "run" PAUSE action = "pause" CONT action = "cont" PASS action = "pass" BENCH action = "bench" FAIL action = "fail" OUTPUT action = "output" SKIP action = "skip" // NOTE: it is set if no tests in a package )
const (
RECURSIVE_SUFFIX = "/..."
)
Variables ¶
var InternalFS fs.FS
InternalFS is a global variable shared within the whole cmd package. It is set in the `Execute()` when main function run because go embed cannot access parent directory.
var SeverityRegex = regexp.MustCompile(fmt.Sprintf(`%s(\w+)`, test.SEVERITY_LOG_PREFIX))
var TestCmd = &cobra.Command{ Use: "test [test path]", Short: "Run tests and generate the result report", Long: `Run tests with go test command and generate a report by specifying a path under which to run tests (default "./...") You also have several options for output type, report path and verbose output`, Args: cobra.MaximumNArgs(1), RunE: runTest, SilenceUsage: true, }
TestCmd represents the test command
Functions ¶
func Execute ¶
Execute adds all child commands to the root command and sets flags appropriately. This is called by main.main(). It only needs to happen once to the rootCmd.
func FirstLower ¶ added in v2.0.9
func FirstUpper ¶ added in v2.0.9
Types ¶
type DockerComposefile ¶
type Dockerfile ¶
type OutputType ¶
type OutputType string
OutputType is a type of output of test results
const ( CLI OutputType = "cli" JSON OutputType = "json" HTML OutputType = "html" )
type Project ¶
type Project struct { // Copyright is the copyright text on the top of every files. Copyright string // PkgPath is the full string of the generated package. (example: github.com/retail-ai-inc/bean/v2) PkgPath string // PkgName is the suffix of the package path, it should match the current directory name. PkgName string // RootDir is the project root directory or current directory when executing the bean command. RootDir string // SubDir is the sub directory under project root using for some commands. (example: upgrade need ./framework) SubDir string // RootFS contains the internal FS directory which need to be walk through recursively, // different cmd may starts with different root path.(init: internal/project, upgrade: internal/project/framework). RootFS fs.FS // Secret is similar like a passphrase to hold a key to generate tokens, hash password or similar security credentials. Secret string // JWT secret/salt JWTSecret string // API Authorization: bearer token to delete a key from Memory database via API call. BearerToken string }
Project holds some necessary data for some cmd.
Source Files ¶
Directories ¶
Path | Synopsis |
---|---|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. |