Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

update polaris test/tools #2

Merged
merged 19 commits into from
Jul 30, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 32 additions & 6 deletions .github/workflows/testing.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,39 @@ jobs:
uses: actions/checkout@v2

# Execute vert check
- name: vert check
- name: Vert check
run: bash vert.sh -install && bash vert.sh

# Run tests
# Compile
- name: Build server
run: bash build.sh

# Run unit tests
- name: run tests
run: |
cd ./test
go test

# TODO: Examine coverage
pushd ./naming/cache
go test -v
popd
pushd ./plugin/ratelimit/tokenBucket
go test -v
popd
pushd ./store/defaultStore
go test -v
popd

# Run interface tests
# - name: run interface tests
# run: |
# work_dir=$(ls | grep polaris-server-release | sed -n '1p')
# echo "work_dir is $work_dir"
# cd $work_dir
# ls -al
# chmod +x ./tool/*.sh
# ./tool/install.sh
# cd ..
# pushd ./test
# go test -count=1 -v
# popd
# cd $work_dir
# ./tool/uninstall.sh
# cd ..
54 changes: 27 additions & 27 deletions build.sh
Original file line number Diff line number Diff line change
@@ -1,27 +1,27 @@
#!/bin/bash
workdir=$(dirname $(realpath $0))
version=$(cat version 2>/dev/null)
folder_name="polaris-server-release_${version}"
pkg_name="${folder_name}.tar.gz"
cd $workdir
# 清理环境
rm -rf ${folder_name}
rm -f "${pkg_name}"
# 编译
rm -f polaris-server
build_date=$(date "+%Y%m%d.%H%M%S")
package="github.com/polarismesh/polaris-server/common/version"
go build -o polaris-server -ldflags="-X ${package}.Version=${version} -X ${package}.BuildDate=${build_date}"
# 打包
mkdir -p ${folder_name}
mv polaris-server ${folder_name}
cp polaris-server.yaml ${folder_name}
cp -r tool ${folder_name}/
tar -czvf "${pkg_name}" ${folder_name}
md5sum ${pkg_name} > "${pkg_name}.md5sum"
#!/bin/bash

workdir=$(dirname $(realpath $0))
version=$(cat version 2>/dev/null)
folder_name="polaris-server-release_${version}"
pkg_name="${folder_name}.tar.gz"

cd $workdir

# 清理环境
rm -rf ${folder_name}
rm -f "${pkg_name}"

# 编译
rm -f polaris-server

build_date=$(date "+%Y%m%d.%H%M%S")
package="github.com/polarismesh/polaris-server/common/version"
go build -o polaris-server -ldflags="-X ${package}.Version=${version} -X ${package}.BuildDate=${build_date}"

# 打包
mkdir -p ${folder_name}
mv polaris-server ${folder_name}
cp polaris-server.yaml ${folder_name}
cp -r tool ${folder_name}/
tar -czvf "${pkg_name}" ${folder_name}
md5sum ${pkg_name} > "${pkg_name}.md5sum"
37 changes: 17 additions & 20 deletions common/log/config.go
Original file line number Diff line number Diff line change
@@ -1,23 +1,20 @@
// Copyright 2017 Istio Authors
//
// Licensed 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.

// Package log provides the canonical logging functionality used by Go-based
// Istio components.
//
// Istio's logging subsystem is built on top of the [Zap](https://godoc.org/go.uber.org/zap) package.
// High performance scenarios should use the Error, Warn, Info, and Debug methods. Lower perf
// scenarios can use the more expensive convenience methods such as Debugf and Warnw.
/**
* Tencent is pleased to support the open source community by making Polaris available.
*
* Copyright (C) 2019 THL A29 Limited, a Tencent company. All rights reserved.
*
* Licensed under the BSD 3-Clause License (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://opensource.org/licenses/BSD-3-Clause
*
* 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.
*/

//
// The package provides direct integration with the Cobra command-line processor which makes it
// easy to build programs that use a consistent interface for logging. Here's an example
Expand Down
29 changes: 16 additions & 13 deletions common/log/default.go
Original file line number Diff line number Diff line change
@@ -1,16 +1,19 @@
// Copyright 2017 Istio Authors
//
// Licensed 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.
/**
* Tencent is pleased to support the open source community by making Polaris available.
*
* Copyright (C) 2019 THL A29 Limited, a Tencent company. All rights reserved.
*
* Licensed under the BSD 3-Clause License (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://opensource.org/licenses/BSD-3-Clause
*
* 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.
*/

package log

Expand Down
29 changes: 16 additions & 13 deletions common/log/options.go
Original file line number Diff line number Diff line change
@@ -1,16 +1,19 @@
// Copyright 2017 Istio Authors
//
// Licensed 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.
/**
* Tencent is pleased to support the open source community by making Polaris available.
*
* Copyright (C) 2019 THL A29 Limited, a Tencent company. All rights reserved.
*
* Licensed under the BSD 3-Clause License (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://opensource.org/licenses/BSD-3-Clause
*
* 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.
*/

package log

Expand Down
29 changes: 16 additions & 13 deletions common/log/scope.go
Original file line number Diff line number Diff line change
@@ -1,16 +1,19 @@
// Copyright 2018 Istio Authors
//
// Licensed 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.
/**
* Tencent is pleased to support the open source community by making Polaris available.
*
* Copyright (C) 2019 THL A29 Limited, a Tencent company. All rights reserved.
*
* Licensed under the BSD 3-Clause License (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://opensource.org/licenses/BSD-3-Clause
*
* 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.
*/

package log

Expand Down
6 changes: 3 additions & 3 deletions common/redispool/redisPool.go
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
/*
/**
* Tencent is pleased to support the open source community by making Polaris available.
*
* Copyright (C) 2020. Lorem THL A29 Limited, a Tencent company. All rights reserved.
* Copyright (C) 2019 THL A29 Limited, a Tencent company. All rights reserved.
*
* Licensed under the BSD 3-Clause License (the "License");
* you may not use this file except in compliance with the License.
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://opensource.org/licenses/BSD-3-Clause
Expand Down
17 changes: 17 additions & 0 deletions naming/cache/cache_test.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,20 @@
/**
* Tencent is pleased to support the open source community by making Polaris available.
*
* Copyright (C) 2019 THL A29 Limited, a Tencent company. All rights reserved.
*
* Licensed under the BSD 3-Clause License (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://opensource.org/licenses/BSD-3-Clause
*
* 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.
*/

package cache

import (
Expand Down
2 changes: 1 addition & 1 deletion naming/platform.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,11 @@ import (
"context"
"errors"
"fmt"
"github.com/golang/protobuf/ptypes/wrappers"
api "github.com/polarismesh/polaris-server/common/api/v1"
"github.com/polarismesh/polaris-server/common/log"
"github.com/polarismesh/polaris-server/common/model"
"github.com/polarismesh/polaris-server/common/utils"
"github.com/golang/protobuf/ptypes/wrappers"
"go.uber.org/zap"
"regexp"
"unicode/utf8"
Expand Down
Loading