diff --git a/Makefile b/Makefile index 0b44a3e02..84d86812e 100644 --- a/Makefile +++ b/Makefile @@ -51,6 +51,7 @@ build_for_integration_test: -o bin/br.test && \ $(GOBUILD) $(RACEFLAG) -o bin/locker tests/br_key_locked/*.go && \ $(GOBUILD) $(RACEFLAG) -o bin/gc tests/br_z_gc_safepoint/*.go && \ + $(GOBUILD) $(RACEFLAG) -o bin/oauth tests/br_gcs/*.go && \ $(GOBUILD) $(RACEFLAG) -o bin/rawkv tests/br_rawkv/*.go) || (make failpoint-disable && exit 1) @make failpoint-disable diff --git a/tests/br_gcs/oauth.go b/tests/br_gcs/oauth.go new file mode 100644 index 000000000..c9fdc8027 --- /dev/null +++ b/tests/br_gcs/oauth.go @@ -0,0 +1,25 @@ +// Copyright 2020 PingCAP, Inc. +// +// 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, +// See the License for the specific language governing permissions and +// limitations under the License. + +package main + +import ( + "net/http" +) + +func main() { + http.HandleFunc("/oauth/token", func(w http.ResponseWriter, r *http.Request) { + _, _ = w.Write([]byte(`{"access_token": "ok", "token_type":"service_account", "expires_in":3600}`)) + }) + _ = http.ListenAndServe(":5000", nil) +} diff --git a/tests/br_gcs/oauth.py b/tests/br_gcs/oauth.py deleted file mode 100644 index 24e686184..000000000 --- a/tests/br_gcs/oauth.py +++ /dev/null @@ -1,9 +0,0 @@ -#!/usr/bin/env python3 - -from flask import Flask - -app = Flask(__name__) - -@app.route('/oauth/token', methods=['GET', 'POST']) -def oauth(): - return '{"access_token": "ok", "token_type":"service_account", "expires_in":3600}' diff --git a/tests/br_gcs/run.sh b/tests/br_gcs/run.sh index a5be052de..b40c74452 100755 --- a/tests/br_gcs/run.sh +++ b/tests/br_gcs/run.sh @@ -36,7 +36,7 @@ while ! curl -o /dev/null -v -s "http://$GCS_HOST:$GCS_PORT/"; do done # start oauth server -FLASK_APP=tests/$TEST_NAME/oauth.py flask run & +bin/oauth & OAUTH_ID=$! stop_gcs() {