Example #1
0
 def test_formatted_trace_file(self):
     mm_config = MahiMahiConfig(self.config, policy=self.policy, client_environment=self.client_environment)
     trace_lines = trace_for_kbps(self.client_environment.bandwidth)
     formatted = format_trace_lines(trace_lines)
     assert mm_config.formatted_trace_file == formatted
Example #2
0
 def test_record_cmd(self):
     save_dir = "/tmp/save_dir"
     mm_config = MahiMahiConfig(self.config)
     record_cmd = mm_config.record_cmd(save_dir)
     assert record_cmd[0] == "mm-webrecord"
     assert record_cmd[1] == save_dir
Example #3
0
 def test_record_shell_with_cmd(self):
     save_dir = "/tmp/save_dir"
     mm_config = MahiMahiConfig(self.config, policy=self.policy)
     cmd = mm_config.record_shell_with_cmd(save_dir, ["a", "command"])
     assert cmd == (mm_config.record_cmd(save_dir) + ["a", "command"])
Example #4
0
 def test_init_with_client_environment(self):
     mm_config = MahiMahiConfig(self.config, policy=self.policy, client_environment=self.client_environment)
     assert isinstance(mm_config, MahiMahiConfig)
     assert mm_config.policy is self.policy
     assert mm_config.client_environment is self.client_environment
Example #5
0
 def test_init_without_policy(self):
     mm_config = MahiMahiConfig(self.config)
     assert isinstance(mm_config, MahiMahiConfig)
     assert mm_config.policy is None
     assert mm_config.client_environment is None
Example #6
0
def get_mahimahi_config() -> MahiMahiConfig:
    return MahiMahiConfig(
        config=get_config(),
        policy=Policy(ActionSpace(get_push_groups())),
        client_environment=get_random_client_environment(),
    )