Skip to content

Commit

Permalink
Merge pull request #363 from crawlab-team/develop
Browse files Browse the repository at this point in the history
Develop
  • Loading branch information
tikazyq authored Dec 15, 2019
2 parents a6f7434 + 377ada8 commit 434ad2f
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 15 deletions.
1 change: 0 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ RUN apt-get update \
RUN pip install scrapy pymongo bs4 requests -i https://pypi.tuna.tsinghua.edu.cn/simple

# copy backend files
COPY --from=backend-build /go/src/app .
COPY --from=backend-build /go/bin/crawlab /usr/local/bin

# install nginx
Expand Down
13 changes: 9 additions & 4 deletions backend/mock/schedule.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,15 @@ import (
"time"
)

var NodeIdss = []bson.ObjectId{bson.ObjectIdHex("5d429e6c19f7abede924fee2"),
bson.ObjectIdHex("5d429e6c19f7abede924fee1")}

var scheduleList = []model.Schedule{
{
Id: bson.ObjectId("5d429e6c19f7abede924fee2"),
Name: "test schedule",
SpiderId: "123",
NodeId: bson.ObjectId("5d429e6c19f7abede924fee2"),
NodeIds: NodeIdss,
Cron: "***1*",
EntryId: 10,
// 前端展示
Expand All @@ -29,7 +32,7 @@ var scheduleList = []model.Schedule{
Id: bson.ObjectId("xx429e6c19f7abede924fee2"),
Name: "test schedule2",
SpiderId: "234",
NodeId: bson.ObjectId("5d429e6c19f7abede924fee2"),
NodeIds: NodeIdss,
Cron: "***1*",
EntryId: 10,
// 前端展示
Expand Down Expand Up @@ -100,8 +103,10 @@ func PutSchedule(c *gin.Context) {
}

// 如果node_id为空,则置为空ObjectId
if item.NodeId == "" {
item.NodeId = bson.ObjectIdHex(constants.ObjectIdNull)
for _, NodeId := range item.NodeIds {
if NodeId == "" {
NodeId = bson.ObjectIdHex(constants.ObjectIdNull)
}
}

c.JSON(http.StatusOK, Response{
Expand Down
4 changes: 2 additions & 2 deletions backend/mock/schedule_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ func TestPostSchedule(t *testing.T) {
Id: bson.ObjectIdHex("5d429e6c19f7abede924fee2"),
Name: "test schedule",
SpiderId: bson.ObjectIdHex("5d429e6c19f7abede924fee2"),
NodeId: bson.ObjectIdHex("5d429e6c19f7abede924fee2"),
NodeIds: NodeIdss,
Cron: "***1*",
EntryId: 10,
// 前端展示
Expand Down Expand Up @@ -112,7 +112,7 @@ func TestPutSchedule(t *testing.T) {
Id: bson.ObjectIdHex("5d429e6c19f7abede924fee2"),
Name: "test schedule",
SpiderId: bson.ObjectIdHex("5d429e6c19f7abede924fee2"),
NodeId: bson.ObjectIdHex("5d429e6c19f7abede924fee2"),
NodeIds: NodeIdss,
Cron: "***1*",
EntryId: 10,
// 前端展示
Expand Down
4 changes: 0 additions & 4 deletions jenkins/develop/docker-compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,6 @@ services:
mongo:
image: mongo:latest
restart: always
ports:
- "27027:27017"
redis:
image: redis:latest
restart: always
ports:
- "6389:6379"
4 changes: 0 additions & 4 deletions jenkins/master/docker-compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,8 @@ services:
restart: always
volumes:
- "/opt/crawlab/mongo/data/db:/data/db"
ports:
- "27017:27017"
redis:
image: redis:latest
restart: always
volumes:
- "/opt/crawlab/redis/data:/data"
ports:
- "6379:6379"

0 comments on commit 434ad2f

Please sign in to comment.