Skip to content

Commit

Permalink
feat: test-int-debug (+ minor fixes)
Browse files Browse the repository at this point in the history
  • Loading branch information
adrienaury authored Sep 3, 2023
1 parent c9a8320 commit ae7f492
Show file tree
Hide file tree
Showing 4 changed files with 87 additions and 66 deletions.
129 changes: 67 additions & 62 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,68 +13,73 @@
"remoteEnv": {
"PATH": "${containerEnv:PATH}:/workspace/bin/"
},
"extensions": [
"golang.Go",
"eamodio.gitlens",
"donjayamanne.githistory",
"DavidAnson.vscode-markdownlint",
"esbenp.prettier-vscode",
"yzhang.markdown-all-in-one",
"ms-azuretools.vscode-docker",
"shardulm94.trailing-spaces",
"vscode-icons-team.vscode-icons",
"johnpapa.vscode-peacock",
"aaron-bond.better-comments",
"quicktype.quicktype",
"spikespaz.vscode-smoothtype",
"EditorConfig.EditorConfig",
],
"settings": {
// General settings
"files.eol": "\n",
// Docker
"remote.extensionKind": {
"ms-azuretools.vscode-docker": "workspace"
},
// Golang general settings
"go.useLanguageServer": true,
"gopls": {
"usePlaceholders": false,
"gofumpt": true
},
"go.lintTool": "golangci-lint",
"go.lintFlags": [
//"--fast",
"--enable-all",
"--disable", "gci",
"--disable", "forbidigo",
"--disable", "scopelint",
"--disable", "interfacer",
"--disable", "maligned",
"--disable", "varcheck",
"--disable", "ifshort",
"--disable", "exhaustivestruct",
"--disable", "nosnakecase",
"--disable", "structcheck",
"--disable", "deadcode",
],
// Golang on save
"go.buildOnSave": "workspace",
"go.lintOnSave": "workspace",
"go.vetOnSave": "workspace",
"editor.formatOnSave": true,
"[go]": {
"editor.codeActionsOnSave": {
"source.organizeImports": true
"customizations": {
"vscode": {
"extensions": [
"golang.Go",
"eamodio.gitlens",
"donjayamanne.githistory",
"DavidAnson.vscode-markdownlint",
"esbenp.prettier-vscode",
"yzhang.markdown-all-in-one",
"ms-azuretools.vscode-docker",
"shardulm94.trailing-spaces",
"vscode-icons-team.vscode-icons",
"johnpapa.vscode-peacock",
"aaron-bond.better-comments",
"quicktype.quicktype",
"spikespaz.vscode-smoothtype",
"EditorConfig.EditorConfig"
],
"settings": {
// General settings
"files.eol": "\n",
// Docker
"remote.extensionKind": {
"ms-azuretools.vscode-docker": "workspace"
},
// Golang general settings
"go.useLanguageServer": true,
"gopls": {
"usePlaceholders": false,
"gofumpt": true
},
"go.lintTool": "golangci-lint",
"go.lintFlags": [
//"--fast",
"--enable-all",
"--disable", "gci",
"--disable", "forbidigo",
"--disable", "scopelint",
"--disable", "interfacer",
"--disable", "maligned",
"--disable", "varcheck",
"--disable", "ifshort",
"--disable", "exhaustivestruct",
"--disable", "nosnakecase",
"--disable", "structcheck",
"--disable", "deadcode",
"--disable", "depguard"
],
// Golang on save
"go.buildOnSave": "workspace",
"go.lintOnSave": "workspace",
"go.vetOnSave": "workspace",
"editor.formatOnSave": true,
"[go]": {
"editor.codeActionsOnSave": {
"source.organizeImports": true
}
},
// Golang testing
"go.testFlags": [
"-v"
],
"go.testTimeout": "600s",
"go.coverOnSingleTest": true,
"go.coverOnSingleTestFile": true,
"go.coverShowCounts": true
}
},
// Golang testing
"go.testFlags": [
"-v"
],
"go.testTimeout": "600s",
"go.coverOnSingleTest": true,
"go.coverOnSingleTestFile": true,
"go.coverShowCounts": true,
}
}
}
20 changes: 18 additions & 2 deletions build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ properties:
"exhaustivestruct",
"depguard",
]
testsuites: "*.yml"
snapshot: false # If true, do not upload release when publish target is used
dockerfiles: # List of Dockerfiles to build, defined by a map of {key=Dockerfile name ; value=path to build context}, the image name will be determined by the extension of the Dockerfile
Dockerfile: . # Build a file named Dockerfile at the root of the workspace, will produce image name "<DOCKERHUB_USER>/<PROJECT>"
Expand Down Expand Up @@ -233,6 +234,12 @@ targets:
steps:
- $: go test -coverprofile=./={BUILD_DIR}/coverage.txt -covermode=atomic ./...

bench:
doc: "Run all bench"
depends: ["info", "refresh"]
steps:
- $: go test -bench=. -benchmem ./... -run=^# -benchtime=10s | tee ./={BUILD_DIR}/benchstats.txt

# run "neon -props '{buildpaths: ["path/to/main/package1","path/to/main/package2"]}' release" to release specific targets
# example : neon -props '{buildpaths: ["cmd/cli"]}' release
release:
Expand All @@ -242,12 +249,21 @@ targets:
- ldflags = ldflags + " -s -w" # Omit the DWARF symbol table. Omit the symbol table and debug information.
- call: compile

# to debug a single test use :
# neon -props '{testsuites: "<test suite filename>"}' test-int-debug
test-int-debug:
doc: "Run all integration tests"
depends: ["info","compile"]
steps:
- delete: venom*.log
- $: venom run test/suites/={testsuites}

test-int:
doc: "Run all integration tests"
depends: ["info", "refresh", "lint", "test", "release"]
depends: ["info", "refresh", "lint", "test", "bench", "release"]
steps:
- delete: venom*.log
- $: venom run test/suites/*
- $: venom run test/suites/={testsuites}

# run "neon -props '{buildpaths: ["path/to/main/package1","path/to/main/package2"]}' publish" to publish specific targets
# example : neon -props '{buildpaths: ["cmd/cli"]}' publish
Expand Down
2 changes: 1 addition & 1 deletion test/suites/01-run-cli.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ name: run cli
testcases:
- name: no arguments
steps:
- script: webserver
- script: cli
assertions:
- result.systemout ShouldContainSubstring Hello World!
- result.code ShouldEqual 0
2 changes: 1 addition & 1 deletion test/suites/02-run-webserver.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ name: run webserver
testcases:
- name: no arguments
steps:
- script: cli
- script: webserver
assertions:
- result.systemout ShouldContainSubstring Hello World!
- result.code ShouldEqual 0

0 comments on commit ae7f492

Please sign in to comment.