blob: a8c3ce54a50391dd246380d89fabfd987b060c2d (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
|
syntax = "proto3";
package test;
option go_package = "gitlab.com/gitlab-org/gitaly/v14/proto/go/internal/linter/testdata";
import "lint.proto";
import "shared.proto";
message InvalidMethodRequest {}
message InvalidMethodRequestWithRepo {
gitaly.Repository destination = 1 [(gitaly.target_repository)=true];
}
message InvalidTargetType {
int32 wrong_type = 1 [(gitaly.target_repository)=true];
}
message InvalidMethodResponse{}
message InvalidNestedRequest{
InvalidTargetType inner_message = 1;
}
message RequestWithStorage {
string storage_name = 1 [(gitaly.storage)=true];
gitaly.Repository destination = 2;
}
message RequestWithStorageAndRepo {
string storage_name = 1 [(gitaly.storage)=true];
gitaly.Repository destination = 2 [(gitaly.target_repository)=true];
}
message RequestWithNestedStorageAndRepo{
RequestWithStorageAndRepo inner_message = 1;
}
message RequestWithMultipleNestedStorage{
RequestWithStorage inner_message = 1;
string storage_name = 2 [(gitaly.storage)=true];
}
message RequestWithInnerNestedStorage {
message Header {
string storage_name = 1 [(gitaly.storage) = true];
}
Header header = 1;
}
message RequestWithWrongTypeRepository {
message Header {
InvalidMethodResponse repository = 1 [(gitaly.repository) = true];
}
Header header = 1 [(gitaly.target_repository) = true];
}
message RequestWithNestedRepoNotFlagged {
message Header {
gitaly.Repository repository = 1;
}
Header header = 1 [(gitaly.target_repository) = true];
}
service InterceptedWithOperationType {
option (gitaly.intercepted) = true;
// intercepted services can't have operation type annotations.
rpc InvalidMethod(InvalidMethodRequest) returns (InvalidMethodResponse) {
option (gitaly.op_type) = {
op: ACCESSOR
};
}
}
service InvalidService {
// should fail if op_type extension is missing
rpc InvalidMethod0(InvalidMethodRequest) returns (InvalidMethodResponse) {}
// should fail if op type is unknown
rpc InvalidMethod1(InvalidMethodRequest) returns (InvalidMethodResponse) {
option (gitaly.op_type).op = UNKNOWN;
}
// should fail if target repo is not provided for accessor
rpc InvalidMethod2(InvalidMethodRequest) returns (InvalidMethodResponse) {
option (gitaly.op_type) = {
op: ACCESSOR
};
}
// should fail if missing either target repo or non-repo-scope for mutator
rpc InvalidMethod4(InvalidMethodRequest) returns (InvalidMethodResponse) {
option (gitaly.op_type).op = MUTATOR;
}
// should fail if repository is not of type Repository
rpc InvalidMethod5(RequestWithWrongTypeRepository) returns (InvalidMethodResponse) {
option (gitaly.op_type).op = MUTATOR;
}
// should fail if nested repository isn't flagged
rpc InvalidMethod6(RequestWithNestedRepoNotFlagged) returns (InvalidMethodResponse) {
option (gitaly.op_type).op = MUTATOR;
}
// should fail if target field type is not of type Repository
rpc InvalidMethod7(InvalidTargetType) returns (InvalidMethodResponse) {
option (gitaly.op_type) = {
op: MUTATOR
};
}
// should fail if nested target field type is not of type Repository
rpc InvalidMethod8(InvalidNestedRequest) returns (InvalidMethodResponse) {
option (gitaly.op_type) = {
op: MUTATOR
};
}
// should fail if target repo is specified for storage scoped RPC
rpc InvalidMethod9(InvalidMethodRequestWithRepo) returns (InvalidMethodResponse) {
option (gitaly.op_type) = {
op: MUTATOR
scope_level: STORAGE
};
}
// should fail if storage is specified for implicit repository scoped RPC
rpc InvalidMethod10(RequestWithStorageAndRepo) returns (InvalidMethodResponse) {
option (gitaly.op_type) = {
op: ACCESSOR
};
}
// should fail if storage is specified for repository scoped RPC
rpc InvalidMethod11(RequestWithNestedStorageAndRepo) returns (InvalidMethodResponse) {
option (gitaly.op_type) = {
op: MUTATOR
scope_level: REPOSITORY
};
}
// should fail if storage isn't specified for storage scoped RPC
rpc InvalidMethod13(InvalidTargetType) returns (InvalidMethodResponse) {
option (gitaly.op_type) = {
op: MUTATOR
scope_level: STORAGE
};
}
// should fail if multiple storage is specified for storage scoped RPC
rpc InvalidMethod14(RequestWithMultipleNestedStorage) returns (InvalidMethodResponse) {
option (gitaly.op_type) = {
op: MUTATOR
scope_level: STORAGE
};
}
// Intercepted methods must not have operation type annotations.
rpc InvalidMethod15(RequestWithStorageAndRepo) returns (InvalidMethodResponse) {
option (gitaly.intercepted_method) = true;
option (gitaly.op_type) = {};
};
}
|