Skip to content

Commit

Permalink
Merge pull request #54 from longfar-ncy/test/integration
Browse files Browse the repository at this point in the history
调整集成测试使用的账户密码,以满足密码强度检验,保证CI的正常使用
  • Loading branch information
longfar-ncy committed Sep 4, 2023
2 parents 9564574 + 682a13b commit f675b59
Show file tree
Hide file tree
Showing 18 changed files with 31 additions and 324 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/StandAloneDouyin.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@ jobs:
with:
redis-port: 6379

- name: start test
- name: Start integration test
run: |
sudo apt install ginkgo
cd tests
bash ./start_douyin.sh
go test ./integration
bash ./start_integration.sh
69 changes: 0 additions & 69 deletions tests/benchmark/feed_test.go

This file was deleted.

28 changes: 0 additions & 28 deletions tests/benchmark/main_test.go

This file was deleted.

File renamed without changes.
1 change: 0 additions & 1 deletion tests/integration/comment_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ import (
var _ = Describe("comment test", func() {
const (
username = "fortest-comment"
password = "fortest-comment"
video_id = 2
content = "This is a comment for test"
)
Expand Down
1 change: 0 additions & 1 deletion tests/integration/favorite_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ import (
var _ = Describe("favorite test", func() {
const (
username = "fortest-favorite"
password = "fortest-favorite"
)

var (
Expand Down
1 change: 0 additions & 1 deletion tests/integration/feed_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,6 @@ var _ = Describe("/douyin/feed api request", func() {
Context("has token", func() {
const (
username = "fortest-feed"
password = "fortest-feed"
)

var (
Expand Down
File renamed without changes.
4 changes: 4 additions & 0 deletions tests/integration/main_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@ import(
. "github.com/onsi/gomega"
)

const (
password = "IntegrationTest!2023"
)

func TestDouyin(t *testing.T) {
RegisterFailHandler(Fail)
RunSpecs(t, "Douyin integration test")
Expand Down
4 changes: 2 additions & 2 deletions tests/integration/message_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,9 @@ var _ = Describe("message test", func() {

BeforeEach(func() {
var err error
idA, tokenA, err = util.GetUseridAndToken(userA, userA)
idA, tokenA, err = util.GetUseridAndToken(userA, password)
Expect(err).To(BeNil())
idB, tokenB, err = util.GetUseridAndToken(userB, userB)
idB, tokenB, err = util.GetUseridAndToken(userB, password)
Expect(err).To(BeNil())
// DoRelationAction(map[string]string{
// "token": tokenA,
Expand Down
18 changes: 9 additions & 9 deletions tests/integration/relation_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,9 @@ var _ = Describe("relation test", func() {
)

BeforeEach(func() {
fanid_, token, err := util.GetUseridAndToken(fan, fan)
fanid_, token, err := util.GetUseridAndToken(fan, password)
Expect(err).To(BeNil())
upid_, _, err := util.GetUseridAndToken(up, up)
upid_, _, err := util.GetUseridAndToken(up, password)
Expect(err).To(BeNil())
fanid = fanid_
upid = upid_
Expand Down Expand Up @@ -124,7 +124,7 @@ var _ = Describe("relation test", func() {
)

BeforeEach(func() {
id, token, err := util.GetUseridAndToken(fan, fan)
id, token, err := util.GetUseridAndToken(fan, password)
Expect(err).To(BeNil())
fanid = id
query["user_id"] = fmt.Sprintf("%d", id)
Expand Down Expand Up @@ -221,7 +221,7 @@ var _ = Describe("relation test", func() {
)

BeforeEach(func() {
id, token, err := util.GetUseridAndToken(up, up)
id, token, err := util.GetUseridAndToken(up, password)
Expect(err).To(BeNil())
upid = id
query["user_id"] = fmt.Sprintf("%d", id)
Expand Down Expand Up @@ -302,7 +302,7 @@ var _ = Describe("relation test", func() {
)

BeforeEach(func() {
id, token, err := util.GetUseridAndToken(userA, userA)
id, token, err := util.GetUseridAndToken(userA, password)
Expect(err).To(BeNil())
query["user_id"] = fmt.Sprintf("%d", id)
query["token"] = token
Expand Down Expand Up @@ -336,12 +336,12 @@ var _ = Describe("relation test", func() {
)

BeforeEach(func() {
id, token, err := util.GetUseridAndToken(userA, userA)
id, token, err := util.GetUseridAndToken(userA, password)
Expect(err).To(BeNil())
queryA["user_id"] = fmt.Sprintf("%d", id)
queryA["token"] = token

id, token, err = util.GetUseridAndToken(userB, userB)
id, token, err = util.GetUseridAndToken(userB, password)
Expect(err).To(BeNil())
queryB["user_id"] = fmt.Sprintf("%d", id)
queryB["token"] = token
Expand Down Expand Up @@ -465,7 +465,7 @@ func actionFollowing(token, action string) (err error) {
for i := 1; i < fansNumber+1; i++ {
u := prefix + fmt.Sprintf("%d", i)
var uid int64
uid, _, err = util.GetUseridAndToken(u, u)
uid, _, err = util.GetUseridAndToken(u, password)
if err != nil {
return
}
Expand All @@ -486,7 +486,7 @@ func actionFollower(upid int64, action string) error {
}
for i := 1; i < fansNumber+1; i++ {
f := user + fmt.Sprintf("%d", i)
_, token, err := util.GetUseridAndToken(f, f)
_, token, err := util.GetUseridAndToken(f, password)
if err != nil {
return err
}
Expand Down
16 changes: 8 additions & 8 deletions tests/integration/user_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ var _ = Describe("user test", func() {
It("should register success", func() {
query := map[string]string{
"username": testuser,
"password": "123456",
"password": password,
}
resp, err := http.Post(util.CreateURL(path, query), "", nil)
Expect(err).To(BeNil())
Expand All @@ -38,7 +38,7 @@ var _ = Describe("user test", func() {
It("username exited", func() {
query := map[string]string{
"username": testuser,
"password": "123456",
"password": password,
}
resp, err := http.Post(util.CreateURL(path, query), "", nil)
Expect(err).To(BeNil())
Expand All @@ -58,7 +58,7 @@ var _ = Describe("user test", func() {
Expect(len(longuser) > 32).To(BeTrue())
query := map[string]string{
"username": longuser,
"password": "000000",
"password": password,
}
resp, err := http.Post(util.CreateURL(path, query), "", nil)
Expect(err).To(BeNil())
Expand All @@ -84,7 +84,7 @@ var _ = Describe("user test", func() {

respData, err := util.GetDouyinResponse[util.DouyinUserRegisterResponse](resp)
Expect(err).To(BeNil())
Expect(respData.StatusCode).To(Equal(int64(10400)))
Expect(respData.StatusCode).To(Equal(int64(10122)))
})

// TODO: password too short and not strong enough
Expand All @@ -94,7 +94,7 @@ var _ = Describe("user test", func() {
const (
path = uPath + "/login"
username = "fortest-login"
password = "fortest-login"
password = password
)
var (
userid int64
Expand Down Expand Up @@ -131,7 +131,7 @@ var _ = Describe("user test", func() {

query := map[string]string{
"username": user,
"password": "hhhhhh",
"password": password,
}
resp, err := http.Post(util.CreateURL(path, query), "", nil)
Expect(err).To(BeNil())
Expand Down Expand Up @@ -172,7 +172,7 @@ var _ = Describe("user test", func() {

BeforeEach(func() {
var err error
id, token, err = util.GetUseridAndToken(username, username)
id, token, err = util.GetUseridAndToken(username, password)
Expect(err).To(BeNil())
userid = fmt.Sprintf("%d", id)
})
Expand Down Expand Up @@ -214,7 +214,7 @@ var _ = Describe("user test", func() {

It("wrong userid", func() {
query := map[string]string{
"user_id": userid + "0",
"user_id": userid + "000",
"token": token,
}
resp, err := http.Get(util.CreateURL(path, query))
Expand Down
42 changes: 0 additions & 42 deletions tests/jmeter_script/comment_list_jmeter.go

This file was deleted.

38 changes: 0 additions & 38 deletions tests/jmeter_script/follower_list_jmeter.go

This file was deleted.

Loading

0 comments on commit f675b59

Please sign in to comment.