Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test: astonishing sophisticated system testing testcase, untested #421

Draft
wants to merge 5 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
45 changes: 45 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
root = true

[*]
charset = utf-8
end_of_line = lf
indent_size = 4
indent_style = space
insert_final_newline = false
max_line_length = 120
tab_width = 4
ij_continuation_indent_size = 8
ij_formatter_off_tag = @formatter:off
ij_formatter_on_tag = @formatter:on
ij_formatter_tags_enabled = false
ij_smart_tabs = false
ij_visual_guides = none
ij_wrap_on_typing = false

[{*.go, *.go2}]
indent_style = tab
ij_continuation_indent_size = 4
ij_go_GROUP_CURRENT_PROJECT_IMPORTS = true
ij_go_add_leading_space_to_comments = true
ij_go_add_parentheses_for_single_import = false
ij_go_call_parameters_new_line_after_left_paren = true
ij_go_call_parameters_right_paren_on_new_line = true
ij_go_call_parameters_wrap = off
ij_go_fill_paragraph_width = 80
ij_go_group_stdlib_imports = true
ij_go_import_sorting = gofmt
ij_go_keep_indents_on_empty_lines = false
ij_go_local_group_mode = project
ij_go_move_all_imports_in_one_declaration = false
ij_go_move_all_stdlib_imports_in_one_group = true
ij_go_remove_redundant_import_aliases = false
ij_go_use_back_quotes_for_imports = false
ij_go_wrap_comp_lit = off
ij_go_wrap_comp_lit_newline_after_lbrace = true
ij_go_wrap_comp_lit_newline_before_rbrace = true
ij_go_wrap_func_params = off
ij_go_wrap_func_params_newline_after_lparen = true
ij_go_wrap_func_params_newline_before_rparen = true
ij_go_wrap_func_result = off
ij_go_wrap_func_result_newline_after_lparen = true
ij_go_wrap_func_result_newline_before_rparen = true
10 changes: 10 additions & 0 deletions testcase/sdk-ticase-4885/.env
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
TI_PARAM_RES_tc: {"provider":"github.com/pingcap/test-infra/sdk/resource/impl/k8s.TiDBClusterClient","name":"tc","testbed":"sdk-ticase-4885-s4q78","type":"TIDB_CLUSTER","ready":true}
TI_PARAM_RES_br: {"provider":"github.com/pingcap/test-infra/sdk/resource/impl/k8s.BRClient","name":"br","testbed":"sdk-ticase-4885-s4q78","type":"BR_NODE","ready":true}
TI_PARAM_RES_go-tpc: {"provider":"github.com/pingcap/test-infra/sdk/resource/impl/k8s.WorkloadNodeClient","name":"go-tpc","testbed":"sdk-ticase-4885-s4q78","type":"WORKLOAD_NODE","ready":true}
TI_PARAM_STR_tpcc_br_storage_uri: s3://tpcc/br-500m-v4.0.13
TI_PARAM_STR_scale_instance_type: tidb
TI_PARAM_STR_scale_size: 1
TI_PARAM_STR_upgrade_target: tidb
TI_PARAM_STR_upgrade_image: pingcap/tidb:v5.0.1
TI_PARAM_STR_phase_interval: 3m
TI_PARAM_STR_metric_interval: 30s
47 changes: 47 additions & 0 deletions testcase/sdk-ticase-4885/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
GO := CGO_ENABLED=0 GOOS=$(GOOS) GOARCH=$(GOARCH) go

.PHONY: run fmt

testbed:
TESTBED_INPUT_SPEC=$$(yq eval -j -I=0 testbed.yaml) \
TESTBED_OUTPUT_SPEC='{"output":"output", "items":[]}' testbed create -s http://172.16.4.180:30007
sed -i "s|REPLACE_ME_WITH_TESTBED_TC|$$(cat output | jq -c '.items[0]')|g" .env
sed -i "s|REPLACE_ME_WITH_TESTBED_BR|$$(cat output | jq -c '.items[1]')|g" .env
sed -i "s|REPLACE_ME_WITH_TESTBED_GO_TPC|$$(cat output | jq -c '.items[2]')|g" .env

destroy-testbed: install-testbed-cli
TESTBED_SETUP_OUTPUT=$$(cat output) testbed delete -s http://172.16.4.180:30007

run:
KUBECONFIG=$(KUBECONFIG) MYSQL_PROXY=socks5://172.16.4.180:30081 go run main/cmd.go

build:
$(GO) build -o bin/example main.go

image:
GOOS=linux GOARCH=amd64 make build
docker build -t hub.pingcap.net/qa/sdk_ticase_4885 .

fmt: groupimports
go fmt ./...

groupimports: install-goimports
goimports -w -l -local github.com/pingcap/test-infra .

install-goimports:
ifeq (, $(shell which goimports))
@{ \
set -e ;\
TMP_DIR=$$(mktemp -d) ;\
cd $$TMP_DIR ;\
GO111MODULE=on go get golang.org/x/tools/cmd/goimports ;\
rm -rf $$TMP_DIR ;\
}
endif

install-testbed-cli:
@{ \
set -e ;\
cd ../../services/rms/cmd ;\
go install ./... ;\
}
21 changes: 21 additions & 0 deletions testcase/sdk-ticase-4885/go.mod
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
module github.com/tipocket/testcase/sdk-ticase-4885

go 1.16

require (
github.com/joho/godotenv v1.3.0
github.com/pingcap/test-infra v0.0.0-20210618145625-d6a1d462d807
github.com/pingcap/test-infra/sdk v0.0.0-20210619005533-233d680ca18f
github.com/prometheus/client_golang v1.11.0
github.com/prometheus/common v0.26.0
go.uber.org/zap v1.16.0
golang.org/x/text v0.3.3 // indirect
golang.org/x/tools v0.0.0-20200812195022-5ae4c3c160a0 // indirect
golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1 // indirect
google.golang.org/appengine v1.6.1 // indirect
google.golang.org/genproto v0.0.0-20191108220845-16a3f7862a1a // indirect
gopkg.in/yaml.v3 v3.0.0-20200605160147-a5ece683394c // indirect
honnef.co/go/tools v0.0.1-2020.1.5 // indirect
)

replace github.com/tipocket/testcase/sdk-ticase-4885 => ./
Loading