| 
 | 1 | +# Copyright 2023 Google LLC  | 
 | 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 | +# https://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 | + | 
 | 16 | +from experiment_tracking import upload_tensorboard_profile_logs_to_experiment_sample  | 
 | 17 | +import test_constants as constants  | 
 | 18 | + | 
 | 19 | + | 
 | 20 | +def test_upload_tensorboard_profile_logs_to_experiment_sample(  | 
 | 21 | + mock_sdk_init,  | 
 | 22 | + mock_tensorboard_uploader_onetime,  | 
 | 23 | +):  | 
 | 24 | + upload_tensorboard_profile_logs_to_experiment_sample.upload_tensorboard_profile_logs_to_experiment_sample(  | 
 | 25 | + project=constants.PROJECT,  | 
 | 26 | + location=constants.LOCATION,  | 
 | 27 | + logdir=constants.TENSORBOARD_LOG_DIR,  | 
 | 28 | + experiment_name=constants.EXPERIMENT_NAME,  | 
 | 29 | + run_name_prefix=constants.EXPERIMENT_RUN_NAME,  | 
 | 30 | + allowed_plugins=constants.TENSORBOARD_PLUGIN_PROFILE_NAME,  | 
 | 31 | + )  | 
 | 32 | + | 
 | 33 | + mock_sdk_init.assert_called_once_with(  | 
 | 34 | + project=constants.PROJECT,  | 
 | 35 | + location=constants.LOCATION,  | 
 | 36 | + experiment=constants.EXPERIMENT_NAME,  | 
 | 37 | + )  | 
 | 38 | + | 
 | 39 | + mock_tensorboard_uploader_onetime.assert_called_once_with(  | 
 | 40 | + logdir=constants.TENSORBOARD_LOG_DIR,  | 
 | 41 | + tensorboard_experiment_name=constants.EXPERIMENT_NAME,  | 
 | 42 | + run_name_prefix=constants.EXPERIMENT_RUN_NAME,  | 
 | 43 | + allowed_plugins=constants.TENSORBOARD_PLUGIN_PROFILE_NAME,  | 
 | 44 | + )  | 
0 commit comments