37
37
38
38
# The absolute path of the current file. This will locate the model_path when
39
39
# run docker containers.
40
- ROOT_DIR = os .path .abspath (os .path .dirname (__file__ ))
40
+ ROOT_DIR = os .environ . get ( 'KOKORO_ROOT' , os . path .abspath (os .path .dirname (__file__ ) ))
41
41
MODEL_PATH = os .path .join (ROOT_DIR , 'model_path' )
42
42
# The cpu docker gcs path is from 'Edge container tutorial'.
43
- DOCKER_GCS_DIR = 'gcr.io/automl-vision-ondevice/'
44
- CPU_DOCKER_GCS_PATH = DOCKER_GCS_DIR + 'gcloud-container-1.12.0:latest'
43
+ CPU_DOCKER_GCS_PATH = 'gcr.io/automl-vision-ondevice/gcloud-container-1.12.0:latest'
45
44
# The path of a sample saved model.
46
- MODEL_GCS_DIR = 'gs://cloud-samples-data/vision/edge_container_predict/'
47
- SAMPLE_SAVED_MODEL = MODEL_GCS_DIR + 'saved_model.pb'
45
+ SAMPLE_SAVED_MODEL = 'gs://cloud-samples-data/vision/edge_container_predict/saved_model.pb'
48
46
# Container Name.
49
47
NAME = 'AutomlVisionEdgeContainerPredictTest'
50
48
# Port Number.
@@ -56,8 +54,8 @@ def edge_container_predict_server_port():
56
54
# set up
57
55
# Pull the CPU docker.
58
56
subprocess .check_output (['docker' , 'pull' , CPU_DOCKER_GCS_PATH ])
59
- # Get the sample saved model.
60
57
58
+ # Get the sample saved model.
61
59
if not os .path .exists (MODEL_PATH ):
62
60
os .mkdir (MODEL_PATH )
63
61
subprocess .check_output (
@@ -79,8 +77,7 @@ def edge_container_predict_server_port():
79
77
# Remove the docker image.
80
78
subprocess .check_output (['docker' , 'rmi' , CPU_DOCKER_GCS_PATH ])
81
79
82
- # TODO(dizcology): Enable tests in future.
83
- @pytest .mark .skip (reason = 'skipping to avoid running docker in docker' )
80
+
84
81
def test_edge_container_predict (capsys , edge_container_predict_server_port ):
85
82
image_file_path = 'test.jpg'
86
83
# If you send requests with one image each time, the key value does not
0 commit comments