File: tests.proto

package info (click to toggle)
golang-google-cloud 0.56.0-6
  • links: PTS, VCS
  • area: main
  • in suites: experimental, forky, sid, trixie
  • size: 22,456 kB
  • sloc: sh: 191; ansic: 75; awk: 64; makefile: 51; asm: 46; python: 21
file content (213 lines) | stat: -rw-r--r-- 6,578 bytes parent folder | download | duplicates (5)
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
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
// Copyright 2019 Google LLC.
//
// 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.
//

// Tests for firestore clients.

syntax = "proto3";

package google.cloud.conformance.firestore.v1;

option php_namespace = "Google\\Cloud\\Firestore\\Tests\\Conformance";
option csharp_namespace = "Google.Cloud.Firestore.Tests.Proto";
option java_outer_classname = "TestDefinition";
option java_package = "com.google.cloud.conformance.firestore.v1";

import "google/firestore/v1/common.proto";
import "google/firestore/v1/document.proto";
import "google/firestore/v1/firestore.proto";
import "google/firestore/v1/query.proto";
import "google/protobuf/timestamp.proto";

// A collection of tests.
message TestFile {
  repeated Test tests = 1;
}

// A Test describes a single client method call and its expected result.
message Test {
  string description = 1; // short description of the test
  string comment = 10; // a comment describing the behavior being tested

  oneof test {
    GetTest         get = 2;
    CreateTest      create = 3;
    SetTest         set = 4;
    UpdateTest      update = 5;
    UpdatePathsTest update_paths = 6;
    DeleteTest      delete = 7;
    QueryTest       query = 8;
    ListenTest      listen = 9;
  }
}

// Call to the DocumentRef.Get method.
message GetTest {
  // The path of the doc, e.g. "projects/projectID/databases/(default)/documents/C/d"
  string doc_ref_path = 1;

  // The request that the call should send to the Firestore service.
  google.firestore.v1.GetDocumentRequest request = 2;
}

// Call to DocumentRef.Create.
message CreateTest {
  // The path of the doc, e.g. "projects/projectID/databases/(default)/documents/C/d"
  string doc_ref_path = 1;

  // The data passed to Create, as JSON. The strings "Delete" and "ServerTimestamp"
  // denote the two special sentinel values. Values that could be interpreted as integers
  // (i.e. digit strings) should be treated as integers.
  string json_data = 2;

  // The request that the call should generate.
  google.firestore.v1.CommitRequest request = 3;

  // If true, the call should result in an error without generating a request.
  // If this is true, request should not be set.
  bool is_error = 4;
}

// A call to DocumentRef.Set.
message SetTest {
  string doc_ref_path = 1;         // path of doc
  SetOption option = 2;            // option to the Set call, if any
  string json_data = 3;            // data (see CreateTest.json_data)
  google.firestore.v1.CommitRequest request = 4; // expected request
  bool is_error = 5;               // call signals an error
}

// A call to the form of DocumentRef.Update that represents the data as a map
// or dictionary.
message UpdateTest {
  string doc_ref_path = 1; // path of doc
  google.firestore.v1.Precondition precondition = 2; // precondition in call, if any
  string json_data  = 3;   // data (see CreateTest.json_data)
  google.firestore.v1.CommitRequest request = 4; // expected request
  bool is_error = 5;       // call signals an error
}

// A call to the form of DocumentRef.Update that represents the data as a list
// of field paths and their values.
message UpdatePathsTest {
  string doc_ref_path = 1; // path of doc
  google.firestore.v1.Precondition precondition = 2; // precondition in call, if any
  // parallel sequences: field_paths[i] corresponds to json_values[i]
  repeated FieldPath field_paths = 3; // the argument field paths
  repeated string json_values = 4;    // the argument values, as JSON
  google.firestore.v1.CommitRequest request = 5; // expected rquest
  bool is_error = 6; // call signals an error
}

// A call to DocmentRef.Delete
message DeleteTest {
  string doc_ref_path = 1; // path of doc
  google.firestore.v1.Precondition precondition = 2;
  google.firestore.v1.CommitRequest request = 3; // expected rquest
  bool is_error = 4;       // call signals an error
}

// An option to the DocumentRef.Set call.
message SetOption {
  bool all = 1;                  // if true, merge all fields ("fields" is ignored).
  repeated FieldPath fields = 2; // field paths for a Merge option
}

message QueryTest {
  string coll_path = 1; // path of collection, e.g. "projects/projectID/databases/(default)/documents/C"
  repeated Clause clauses = 2;
  google.firestore.v1.StructuredQuery query = 3;
  bool is_error = 4;
}

message Clause {
  oneof clause {
    Select select = 1;
    Where where = 2;
    OrderBy order_by = 3;
    int32 offset = 4;
    int32 limit = 5;
    Cursor start_at = 6;
    Cursor start_after = 7;
    Cursor end_at = 8;
    Cursor end_before = 9;
  }
}

message Select {
  repeated FieldPath fields = 1;
}

message Where {
  FieldPath path = 1;
  string op = 2;
  string json_value = 3;
}

message OrderBy {
  FieldPath path = 1;
  string direction = 2; // "asc" or "desc"
}

message Cursor {
  // one of:
  DocSnapshot doc_snapshot = 1;
  repeated string json_values = 2;
}

message DocSnapshot {
  string path = 1;
  string json_data = 2;
}

message FieldPath {
  repeated string field = 1;
}

// A test of the Listen streaming RPC (a.k.a. FireStore watch).
// If the sequence of responses is provided to the implementation,
// it should produce the sequence of snapshots.
// If is_error is true, an error should occur after the snapshots.
//
// The tests assume that the query is
// Collection("projects/projectID/databases/(default)/documents/C").OrderBy("a", Ascending)
//
// The watch target ID used in these tests is 1. Test interpreters
// should either change their client's ID for testing,
// or change the ID in the tests before running them.
message ListenTest {
  repeated google.firestore.v1.ListenResponse responses = 1;
  repeated Snapshot snapshots = 2;
  bool is_error = 3;
}

message Snapshot {
  repeated google.firestore.v1.Document docs = 1;
  repeated DocChange changes = 2;
  google.protobuf.Timestamp read_time = 3;
}

message DocChange {
  enum Kind {
    KIND_UNSPECIFIED = 0;
    ADDED = 1;
    REMOVED = 2;
    MODIFIED = 3;
  }

  Kind kind = 1;
  google.firestore.v1.Document doc = 2;
  int32 old_index = 3;
  int32 new_index = 4;
}