Skip to content

Commit

Permalink
add some testing scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
jianzhiyao committed Jan 28, 2021
1 parent 7e3703d commit 4dca228
Show file tree
Hide file tree
Showing 4 changed files with 93 additions and 0 deletions.
13 changes: 13 additions & 0 deletions scripts/adapter.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#!/bin/sh

# using pkg/adapter. Usually you want to migrate to V2 smoothly, you could running this script

find ./ -name '*.go' -type f -exec sed -i '' -e 's/github.com\/astaxie\/beego/github.com\/astaxie\/beego\/pkg\/adapter/g' {} \;
find ./ -name '*.go' -type f -exec sed -i '' -e 's/"github.com\/astaxie\/beego\/pkg\/adapter"/beego "github.com\/astaxie\/beego\/pkg\/adapter"/g' {} \;

update rrp_flow set status = 4 where flow_id in (5623711176,5629411891)

select * from rrp_flow where flow_id in (5623711176,5629411891) and status = 5

update rrp_flow set status = 5 where flow_id in (5623711176,5629411891)

8 changes: 8 additions & 0 deletions scripts/prepare_etcd.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#!/bin/bash

etcdctl put current.float 1.23
etcdctl put current.bool true
etcdctl put current.int 11
etcdctl put current.string hello
etcdctl put current.serialize.name test
etcdctl put sub.sub.key1 sub.sub.key
17 changes: 17 additions & 0 deletions scripts/test.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#!/bin/bash

docker-compose -f "$(pwd)/scripts/test_docker_compose.yaml" up -d

export ORM_DRIVER=mysql
export TZ=UTC
export ORM_SOURCE="beego:test@tcp(localhost:13306)/orm_test?charset=utf8"

# wait for services in images ready
sleep 5

go test "$(pwd)/..."

# clear all container
docker-compose -f "$(pwd)/scripts/test_docker_compose.yaml" down


55 changes: 55 additions & 0 deletions scripts/test_docker_compose.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
version: "3.8"
services:
redis:
container_name: "beego-redis"
image: redis
environment:
- ALLOW_EMPTY_PASSWORD=yes
ports:
- "6379:6379"

mysql:
container_name: "beego-mysql"
image: mysql:5.7.30
ports:
- "13306:3306"
environment:
- MYSQL_ROOT_PASSWORD=1q2w3e
- MYSQL_DATABASE=orm_test
- MYSQL_USER=beego
- MYSQL_PASSWORD=test

postgresql:
container_name: "beego-postgresql"
image: bitnami/postgresql:latest
ports:
- "5432:5432"
environment:
- ALLOW_EMPTY_PASSWORD=yes
ssdb:
container_name: "beego-ssdb"
image: wendal/ssdb
ports:
- "8888:8888"
memcache:
container_name: "beego-memcache"
image: memcached
ports:
- "11211:11211"
etcd:
command: >
sh -c "
etcdctl put current.float 1.23
&& etcdctl put current.bool true
&& etcdctl put current.int 11
&& etcdctl put current.string hello
&& etcdctl put current.serialize.name test
"
container_name: "beego-etcd"
environment:
- ALLOW_NONE_AUTHENTICATION=yes
# - ETCD_ADVERTISE_CLIENT_URLS=http://etcd:2379
image: bitnami/etcd
ports:
- "2379:2379"
- "2380:2380"

0 comments on commit 4dca228

Please sign in to comment.