File tree Expand file tree Collapse file tree
spanner/tests/system/utils Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1414
1515"""Depopulate spanner databases with data for streaming system tests."""
1616
17- import os
18-
1917from google .cloud .spanner import Client
20- from google .cloud .spanner .keyset import KeySet
2118from google .cloud .spanner .pool import BurstyPool
2219
23-
24- INSTANCE_NAME = 'gcp-streaming-systests'
25- DATABASE_NAME = 'testing'
26-
27-
28- def print_func (message ):
29- if os .getenv ('GOOGLE_CLOUD_NO_PRINT' ) != 'true' :
30- print (message )
20+ # Import relative to the script's directory
21+ from streaming_utils import DATABASE_NAME
22+ from streaming_utils import INSTANCE_NAME
23+ from streaming_utils import print_func
3124
3225
3326def remove_database (client ):
Original file line number Diff line number Diff line change 1414
1515"""Populate spanner databases with data for streaming system tests."""
1616
17- import os
18-
1917from google .cloud .spanner import Client
2018from google .cloud .spanner .keyset import KeySet
2119from google .cloud .spanner .pool import BurstyPool
2220
23-
24- INSTANCE_NAME = 'gcp-streaming-systests'
25- DATABASE_NAME = 'testing'
21+ # Import relative to the script's directory
22+ from streaming_utils import DATABASE_NAME
23+ from streaming_utils import INSTANCE_NAME
24+ from streaming_utils import print_func
2625
2726DDL = """\
2827 CREATE TABLE four_kay (
4746DDL_STATEMENTS = [stmt .strip () for stmt in DDL .split (';' ) if stmt .strip ()]
4847
4948
50- def print_func (message ):
51- if os .getenv ('GOOGLE_CLOUD_NO_PRINT' ) != 'true' :
52- print (message )
53-
54-
5549def ensure_database (client ):
5650 instance = client .instance (INSTANCE_NAME )
5751
Original file line number Diff line number Diff line change 1+ # Copyright 2017 Google Inc.
2+ #
3+ # Licensed under the Apache License, Version 2.0 (the "License");
4+ # you may not use this file except in compliance with the License.
5+ # You may obtain a copy of the License at
6+ #
7+ # http://www.apache.org/licenses/LICENSE-2.0
8+ #
9+ # Unless required by applicable law or agreed to in writing, software
10+ # distributed under the License is distributed on an "AS IS" BASIS,
11+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+ # See the License for the specific language governing permissions and
13+ # limitations under the License.
14+
15+ import os
16+
17+ INSTANCE_NAME = 'gcp-streaming-systests'
18+ DATABASE_NAME = 'testing'
19+ _SHOULD_PRINT = os .getenv ('GOOGLE_CLOUD_NO_PRINT' ) != 'true'
20+
21+
22+ def print_func (message ):
23+ if _SHOULD_PRINT :
24+ print (message )
You can’t perform that action at this time.
0 commit comments