-
Notifications
You must be signed in to change notification settings - Fork 50
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(mis/portal): 增加获取 SCOW API 版本的接口 (#1381)
### 做了什么 增加了一个proto接口 getVersion,可以用来获取scow的版本,方便其它服务判断当前部署的scow是否支持某些功能
- Loading branch information
Showing
6 changed files
with
107 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
"@scow/grpc-api": minor | ||
--- | ||
|
||
增加获取 SCOW API 版本的接口 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
--- | ||
"@scow/portal-server": patch | ||
"@scow/mis-server": patch | ||
--- | ||
|
||
增加获取 SCOW API 版本的接口 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
/** | ||
* Copyright (c) 2022 Peking University and Peking University Institute for Computing and Digital Economy | ||
* SCOW is licensed under Mulan PSL v2. | ||
* You can use this software according to the terms and conditions of the Mulan PSL v2. | ||
* You may obtain a copy of Mulan PSL v2 at: | ||
* http://license.coscl.org.cn/MulanPSL2 | ||
* THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, | ||
* EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, | ||
* MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. | ||
* See the Mulan PSL v2 for more details. | ||
*/ | ||
|
||
/** | ||
* Copyright (c) 2022 Peking University and Peking University Institute for Computing and Digital Economy | ||
* SCOW is licensed under Mulan PSL v2. | ||
* You can use this software according to the terms and conditions of the Mulan PSL v2. | ||
* You may obtain a copy of Mulan PSL v2 at: | ||
* http://license.coscl.org.cn/MulanPSL2 | ||
* THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, | ||
* EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, | ||
* MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. | ||
* See the Mulan PSL v2 for more details. | ||
*/ | ||
|
||
import { asyncUnaryCall } from "@ddadaal/tsgrpc-client"; | ||
import { Server } from "@ddadaal/tsgrpc-server"; | ||
import { credentials } from "@grpc/grpc-js"; | ||
import { ConfigServiceClient } from "@scow/protos/build/common/config"; | ||
import { readFileSync } from "fs"; | ||
import { join } from "path"; | ||
import { createServer } from "src/app"; | ||
|
||
let server: Server; | ||
let client: ConfigServiceClient; | ||
|
||
beforeEach(async () => { | ||
|
||
server = await createServer(); | ||
|
||
await server.start(); | ||
|
||
client = new ConfigServiceClient(server.serverAddress, credentials.createInsecure()); | ||
}); | ||
|
||
afterEach(async () => { | ||
await server.close(); | ||
}); | ||
|
||
it("get scow version configs info", async () => { | ||
|
||
const reply = await asyncUnaryCall(client, "getApiVersion", { query: {} }); | ||
|
||
const version = await JSON.parse(readFileSync(join(__dirname, | ||
"../../node_modules/@scow/protos/package.json"), "utf-8")).version; | ||
const [major, minor, patch] = version.split(".").map(Number); | ||
console.log(version); | ||
expect(reply.major).toBe(major); | ||
expect(reply.minor).toBe(minor); | ||
expect(reply.patch).toBe(patch); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters