288 lines
5.7 KiB
Protocol Buffer
288 lines
5.7 KiB
Protocol Buffer
syntax = "proto3";
|
|
|
|
option go_package = "github.com/linuxsuren/api-testing/pkg/server";
|
|
|
|
package server;
|
|
|
|
service Runner {
|
|
// belong to a specific store
|
|
rpc Run (TestTask) returns (TestResult) {}
|
|
|
|
rpc GetSuites(Empty) returns (Suites) {}
|
|
rpc CreateTestSuite(TestSuiteIdentity) returns (HelloReply) {}
|
|
rpc ImportTestSuite(TestSuiteSource) returns (CommonResult) {}
|
|
rpc GetTestSuite(TestSuiteIdentity) returns (TestSuite) {}
|
|
rpc UpdateTestSuite(TestSuite) returns (HelloReply) {}
|
|
rpc DeleteTestSuite(TestSuiteIdentity) returns (HelloReply) {}
|
|
|
|
// test cases related
|
|
rpc ListTestCase(TestSuiteIdentity) returns (Suite) {}
|
|
rpc GetSuggestedAPIs(TestSuiteIdentity) returns (TestCases) {}
|
|
rpc RunTestCase(TestCaseIdentity) returns (TestCaseResult) {}
|
|
rpc GetTestCase(TestCaseIdentity) returns (TestCase) {}
|
|
rpc CreateTestCase(TestCaseWithSuite) returns (HelloReply) {}
|
|
rpc UpdateTestCase(TestCaseWithSuite) returns (HelloReply) {}
|
|
rpc DeleteTestCase(TestCaseIdentity) returns (HelloReply) {}
|
|
|
|
// code generator
|
|
rpc ListCodeGenerator(Empty) returns (SimpleList) {}
|
|
rpc GenerateCode(CodeGenerateRequest) returns (CommonResult) {}
|
|
|
|
// converter
|
|
rpc ListConverter(Empty) returns (SimpleList) {}
|
|
rpc ConvertTestSuite(CodeGenerateRequest) returns (CommonResult) {}
|
|
|
|
// common services
|
|
rpc PopularHeaders(Empty) returns (Pairs) {}
|
|
rpc FunctionsQuery(SimpleQuery) returns (Pairs) {}
|
|
rpc FunctionsQueryStream(stream SimpleQuery) returns (stream Pairs) {}
|
|
rpc GetVersion(Empty) returns (HelloReply) {}
|
|
rpc Sample(Empty) returns (HelloReply) {}
|
|
|
|
// stores related interfaces
|
|
rpc GetStoreKinds(Empty) returns (StoreKinds) {}
|
|
rpc GetStores(Empty) returns (Stores) {}
|
|
rpc CreateStore(Store) returns (Store) {}
|
|
rpc UpdateStore(Store) returns (Store) {}
|
|
rpc DeleteStore(Store) returns (Store) {}
|
|
rpc VerifyStore(SimpleQuery) returns (ExtensionStatus) {}
|
|
|
|
// secret related interfaces
|
|
rpc GetSecrets(Empty) returns (Secrets) {}
|
|
rpc CreateSecret(Secret) returns (CommonResult) {}
|
|
rpc DeleteSecret(Secret) returns (CommonResult) {}
|
|
rpc UpdateSecret(Secret) returns (CommonResult) {}
|
|
|
|
// extension
|
|
rpc PProf(PProfRequest) returns (PProfData) {}
|
|
}
|
|
|
|
service RunnerExtension {
|
|
rpc Run(TestSuiteWithCase) returns (CommonResult) {}
|
|
}
|
|
|
|
message Suites {
|
|
map<string, Items> data = 1;
|
|
}
|
|
|
|
message Items {
|
|
repeated string data = 1;
|
|
string kind = 2;
|
|
}
|
|
|
|
message TestCaseIdentity {
|
|
string suite = 1;
|
|
string testcase = 2;
|
|
repeated Pair parameters = 3;
|
|
}
|
|
|
|
message TestSuiteSource {
|
|
string kind = 1;
|
|
string url = 2;
|
|
string data = 3;
|
|
}
|
|
|
|
message TestSuite {
|
|
string name = 1;
|
|
string api = 2;
|
|
repeated Pair param = 3;
|
|
APISpec spec = 4;
|
|
}
|
|
|
|
message TestSuiteWithCase {
|
|
TestSuite suite = 1;
|
|
TestCase case = 2;
|
|
}
|
|
|
|
message APISpec {
|
|
string kind = 1;
|
|
string url = 2;
|
|
RPC rpc = 3;
|
|
Secure secure = 4;
|
|
}
|
|
|
|
message Secure {
|
|
bool insecure = 1;
|
|
string cert = 2;
|
|
string ca = 3;
|
|
string serverName = 4;
|
|
string key = 5;
|
|
}
|
|
|
|
message RPC{
|
|
repeated string import = 1;
|
|
bool serverReflection = 2;
|
|
string protofile = 3;
|
|
string protoset = 4;
|
|
string raw = 5;
|
|
}
|
|
|
|
message TestSuiteIdentity {
|
|
string name = 1;
|
|
string api = 2;
|
|
string kind = 3;
|
|
}
|
|
|
|
message TestTask {
|
|
string data = 1;
|
|
string kind = 2;
|
|
string caseName = 3;
|
|
string level = 4;
|
|
map<string, string> env = 5;
|
|
repeated Pair parameters = 6;
|
|
}
|
|
|
|
message TestResult {
|
|
string message = 1;
|
|
string error = 2;
|
|
repeated TestCaseResult testCaseResult = 3;
|
|
}
|
|
|
|
message HelloReply {
|
|
string message = 1;
|
|
string error = 2;
|
|
}
|
|
|
|
message Suite {
|
|
string name = 1;
|
|
string api = 2;
|
|
repeated TestCase items = 3;
|
|
}
|
|
|
|
message TestCaseWithSuite {
|
|
string suiteName = 1;
|
|
TestCase data = 2;
|
|
}
|
|
|
|
message TestCases {
|
|
repeated TestCase data = 1;
|
|
}
|
|
|
|
message TestCase {
|
|
string name = 1;
|
|
string suiteName = 2;
|
|
Request request = 3;
|
|
Response response = 4;
|
|
}
|
|
|
|
message Request {
|
|
string api = 1;
|
|
string method = 2;
|
|
repeated Pair header = 3;
|
|
repeated Pair query = 4;
|
|
repeated Pair form = 5;
|
|
string body = 6;
|
|
}
|
|
|
|
message Response {
|
|
int32 statusCode = 1;
|
|
string body = 2;
|
|
repeated Pair header = 3;
|
|
repeated Pair bodyFieldsExpect = 4;
|
|
repeated string verify = 5;
|
|
repeated ConditionalVerify ConditionalVerify = 6;
|
|
string schema = 7;
|
|
}
|
|
|
|
message ConditionalVerify {
|
|
repeated string condition = 1;
|
|
repeated string verify = 2;
|
|
}
|
|
|
|
message TestCaseResult {
|
|
int32 statusCode = 1;
|
|
string body = 2;
|
|
repeated Pair header = 3;
|
|
string error = 4;
|
|
string id = 5;
|
|
string output = 6;
|
|
}
|
|
|
|
message Pair {
|
|
string key = 1;
|
|
string value = 2;
|
|
}
|
|
|
|
message Pairs {
|
|
repeated Pair data = 1;
|
|
}
|
|
|
|
message SimpleQuery {
|
|
string name = 1;
|
|
}
|
|
|
|
message Stores {
|
|
repeated Store data = 1;
|
|
}
|
|
|
|
message Store {
|
|
string name = 1;
|
|
string owner = 2;
|
|
string description = 3;
|
|
string url = 4;
|
|
string username = 5;
|
|
string password = 6;
|
|
repeated Pair properties = 7;
|
|
StoreKind kind = 8;
|
|
bool ready = 9;
|
|
bool readOnly = 10;
|
|
bool disabled = 11;
|
|
}
|
|
|
|
message StoreKinds {
|
|
repeated StoreKind data = 1;
|
|
}
|
|
|
|
message StoreKind {
|
|
string name = 1;
|
|
string url = 2;
|
|
bool enabled = 3;
|
|
}
|
|
|
|
message CommonResult {
|
|
bool success = 1;
|
|
string message = 2;
|
|
}
|
|
|
|
message SimpleList {
|
|
repeated Pair data = 1;
|
|
}
|
|
|
|
message SimpleName {
|
|
string name = 1;
|
|
}
|
|
|
|
message CodeGenerateRequest {
|
|
string TestSuite = 1;
|
|
string TestCase = 2;
|
|
string Generator = 3;
|
|
}
|
|
|
|
message Secrets {
|
|
repeated Secret data = 1;
|
|
}
|
|
|
|
message Secret {
|
|
string Name = 1;
|
|
string Value = 2;
|
|
string Description = 3;
|
|
}
|
|
|
|
message ExtensionStatus {
|
|
bool ready = 1;
|
|
bool readOnly = 2;
|
|
string version = 3;
|
|
string message = 4;
|
|
}
|
|
|
|
message PProfRequest {
|
|
string name = 1;
|
|
}
|
|
|
|
message PProfData {
|
|
bytes data = 1;
|
|
}
|
|
|
|
message Empty {
|
|
}
|