Skip to content

Commit

Permalink
Merge pull request #1 from DMwangnima/main
Browse files Browse the repository at this point in the history
CI: migrate tests from codec-dubbo and provide integrated test script
  • Loading branch information
felix021 authored Dec 22, 2023
2 parents d3acc93 + 5617ace commit 5a3c262
Show file tree
Hide file tree
Showing 125 changed files with 32,882 additions and 6 deletions.
18 changes: 13 additions & 5 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ jobs:
unit-benchmark-test:
strategy:
matrix:
go: [ 1.17, 1.18, 1.19 ]
go: [ '1.17', '1.18', '1.19', '1.20', '1.21' ]
os: [ X64, ARM64 ]
runs-on: ${{ matrix.os }}
steps:
Expand All @@ -25,8 +25,16 @@ jobs:
# restore-keys: |
# ${{ runner.os }}-go-

- name: Unit Test
run: go test -race -covermode=atomic -coverprofile=coverage.out ./...
- name: Set up Java
uses: actions/setup-java@v3
with:
distribution: 'zulu'
java-version: 8

- name: Set up Maven
uses: stCarolas/[email protected]
with:
maven-version: 3.9.4

- name: Benchmark
run: go test -bench=. -benchmem -run=none ./...
- name: Run Tests
run: ./run.sh
6 changes: 6 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -28,3 +28,9 @@ output/*
# Vscode files
.vscode

# Maven generated files
code/dubbo-java/target/

# java thrift
code/kitex/java.thrift

39 changes: 39 additions & 0 deletions .licenserc.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,48 @@ header:
license:
spdx-id: Apache-2.0
copyright-owner: CloudWeGo Authors
content: | # `license` will be used as the content when `fix` command needs to insert a license header.
Copyright 2023 CloudWeGo Authors
Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with
this work for additional information regarding copyright ownership.
The ASF licenses this file to You under the Apache License, Version 2.0
(the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
# `pattern` is optional regexp if all the file headers are the same as `license` or the license of `spdx-id` and `copyright-owner`.
pattern: |
Copyright 2023 CloudWeGo Authors
Licensed to the Apache Software Foundation under one or more contributor
license agreements. See the NOTICE file distributed with
this work for additional information regarding copyright
ownership. The Apache Software Foundation licenses this file to you under
the Apache License, Version 2.0 \(the "License"\); you may
not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
paths:
- '**/*.go'
- '**/*.s'

paths-ignore:
- 'code'
- 'benchmark'

comment: on-failure
11 changes: 11 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
ZOOKEEPRER_VERSION ?= 3.7.0

run:
wget "https://archive.apache.org/dist/zookeeper/zookeeper-$(ZOOKEEPRER_VERSION)/apache-zookeeper-$(ZOOKEEPRER_VERSION)-bin.tar.gz"
tar -xvf apache-zookeeper-$(ZOOKEEPRER_VERSION)-bin.tar.gz
mv apache-zookeeper-$(ZOOKEEPRER_VERSION)-bin zookeeper
cp zookeeper/conf/zoo_sample.cfg zookeeper/conf/zoo.cfg
./zookeeper/bin/zkServer.sh start

stop:
./zookeeper/bin/zkServer.sh stop
48 changes: 47 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1 +1,47 @@
# .github
# codec-dubbo-tests

This repository contains integrated tests for [codec-dubbo](https://github.com/kitex-contrib/codec-dubbo).

## Integrated Tests Categories

All the tests are stored in **tests/** directory.

1. crosstest/dubbo2kitex
2. crosstest/kitex2dubbo
3. crosstest/kitex2kitex
4. registry_test/registry
5. registry_test/resolver

These tests categories correspond to the test subdirectories in **run.sh**.

### Add Test Cases in Existing Integrated Tests Categories

Please refer to the concrete category for detail.

### Add New Test Category

1. Create sub-dir in **tests/** directory. **Make sure that this sub-dir could be tested
by ```go test``` directly.**
2. Add this sub-dir to **tests** variable in **run.sh**

## Local Test

### Modify Client/Server Code

If you need to modify Client/Server Code, please refer to code/ directory. For the kitex part,
please refer to [codec-dubbo](https://github.com/kitex-contrib/codec-dubbo) for detailed usage.

### Test What You Want

**run.sh** would test all integrated test categories stored in **tests** variable by default.
To save time, you could remain the test category you want and comment others.

### Test

```shell
./run.sh
```

## For codec-dubbo CI

**run.sh** would accept a parameter to replace codec-dubbo version for CI.
136 changes: 136 additions & 0 deletions benchmark/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,136 @@
# Benchmark

Make use of deploy.sh to deploy. Benchmark results would be stored in **stress_log**, client
and server logs would be stored in **client_log** and **server_log**

## Sub Commands

### Start the dubbo server process

```bash
# dubbo_server process would listen on :20001
sh deploy.sh dubbo_server

# specify listening port
sh deploy.sh dubbo_server -p 21001
```

### Start the kitex server process

```bash
# kitex_server process would listen on :20001
sh deploy.sh kitex_server

# specify listening port
sh deploy.sh kitex_server -p 21001
```

### Start the dubbo client process

```bash
# dubbo_client process would connect to dubbo_server with "127.0.0.1:20001"
# and listen on :20000
sh deploy.sh dubbo_client

# specify listening port
sh deploy.sh dubbo_client -p 21000

# specify dubbo_server address
sh deploy.sh dubbo_client -addr "192.168.0.2:20001"
```

### Start the kitex client process

```bash
# kitex_client process would connect to kitex_server with "127.0.0.1:20001"
# and listen on :20000
sh deploy.sh kitex_client

# specify listening port
sh deploy.sh kitex_client -p 21000

# specify kitex_server address
sh deploy.sh kitex_client -addr "192.168.0.2:20001"
```

### Start the stress process

```bash
# stress process would connect to dubbo_server with "127.0.0.1:20000"
# default tps: 100, parallel: 10, payloadLen: 10
sh deploy.sh stress

# specify dubbo_client address
sh deploy.sh stress -addr "192.168.0.3:20000"

# specify tps upper bound
sh deploy.sh stress -t 200

# specify parallel clients
sh deploy.sh stress -p 100

# specify payloadLen with byte unit
sh deploy.sh stress -l 256
```

### Close processes

```bash
# close all related processes
sh deploy.sh close all

sh deploy.sh close stress

sh deploy.sh close dubbo_client

sh deploy.sh close kitex_client

sh deploy.sh close dubbo_server

sh deploy.sh close kitex_server
```

## Benchmark kitex2kitex

```bash
# stress, kitex_client, kitex_server are on the same machine
# startup order: server -> client -> stress
sh deploy.sh kitex_server
sh deploy.sh kitex_client
sh deploy.sh stress -t 50000
sh deploy.sh close all
```

## Benchmark dubbo2dubbo

```bash
# assuming stress, dubbo_client, dubbo_server are on the same machine
# startup order: server -> client -> stress
sh deploy.sh dubbo_server
sh deploy.sh dubbo_client
sh deploy.sh stress -t 50000
sh deploy.sh close all
```

## Benchmark kitex2dubbo

```bash
# assuming stress, kitex_client, dubbo_server are on the same machine
# startup order: server -> client -> stress
sh deploy.sh dubbo_server
sh deploy.sh kitex_client
sh deploy.sh stress -t 50000
sh deploy.sh close all
```

## Benchmark dubbo2kitex

```bash
# assuming stress, dubbo_client, kitex_server are on the same machine
# startup order: server -> client -> stress
sh deploy.sh kitex_server
sh deploy.sh dubbo_client
sh deploy.sh stress -t 50000
sh deploy.sh close all
```

Loading

0 comments on commit 5a3c262

Please sign in to comment.