change: trigger actions on push to main branch

This commit is contained in:
debugtalk
2022-03-28 20:42:43 +08:00
parent f5e80989c4
commit 2da93086a4
7 changed files with 15 additions and 9 deletions

View File

@@ -2,6 +2,8 @@ name: Run scaffold for hrp
on:
push:
branches:
- main
pull_request:
types: [synchronize]

View File

@@ -2,6 +2,8 @@ name: run smoke tests for httprunner
on:
push:
branches:
- main
pull_request:
types: [synchronize]

View File

@@ -2,6 +2,8 @@ name: Run unittests
on:
push:
branches:
- main
pull_request:
types: [synchronize]

View File

@@ -153,7 +153,7 @@ var demoTestCaseWithoutPlugin = &TestCase{
}
func TestGenDemoTestCase(t *testing.T) {
tCase := convertTestCase(demoTestCaseWithPlugin)
tCase := demoTestCaseWithPlugin.ToTCase()
err := builtin.Dump2JSON(tCase, demoTestCaseWithPluginJSONPath.GetPath())
if err != nil {
t.Fail()
@@ -163,7 +163,7 @@ func TestGenDemoTestCase(t *testing.T) {
t.Fail()
}
tCase = convertTestCase(demoTestCaseWithoutPlugin)
tCase = demoTestCaseWithoutPlugin.ToTCase()
err = builtin.Dump2JSON(tCase, demoTestCaseWithoutPluginJSONPath.GetPath())
if err != nil {
t.Fail()

View File

@@ -323,11 +323,11 @@ func (tc *TestCase) ToTestCase() (*TestCase, error) {
return tc, nil
}
func convertTestCase(testcase *TestCase) *TCase {
func (tc *TestCase) ToTCase() *TCase {
tCase := &TCase{
Config: testcase.Config,
Config: tc.Config,
}
for _, step := range testcase.TestSteps {
for _, step := range tc.TestSteps {
tCase.TestSteps = append(tCase.TestSteps, step.ToStruct())
}
return tCase

View File

@@ -567,7 +567,7 @@ func (r *caseRunner) runStepRendezvous(rendezvous *Rendezvous) (stepResult *step
}
func (r *caseRunner) isPreRendezvousAllReleased(rendezvous *Rendezvous) bool {
tCase := convertTestCase(r.TestCase)
tCase := r.TestCase.ToTCase()
for _, step := range tCase.TestSteps {
preRendezvous := step.Rendezvous
if preRendezvous == nil {
@@ -614,7 +614,7 @@ func (r *Rendezvous) setReleased() {
}
func initRendezvous(testcase *TestCase, total int64) []*Rendezvous {
tCase := convertTestCase(testcase)
tCase := testcase.ToTCase()
var rendezvousList []*Rendezvous
for _, step := range tCase.TestSteps {
if step.Rendezvous == nil {

View File

@@ -287,12 +287,12 @@ func TestRunCaseWithRefAPI(t *testing.T) {
func TestLoadTestCases(t *testing.T) {
// load test cases from folder path
tc := TestCasePath(templatesDir + "testcases")
tc := TestCasePath("../examples/demo-with-py-plugin/testcases/")
testCases, err := loadTestCases(&tc)
if !assert.Nil(t, err) {
t.Fail()
}
if !assert.GreaterOrEqual(t, len(testCases), 5) {
if !assert.Equal(t, len(testCases), 3) {
t.Fail()
}