def test_file(self): a = "中文 测试 abc" data_id = "com.alibaba.cloud.acm:sample-app.properties" group = "group" key = "+".join([data_id, group, NAMESPACE]) files.delete_file(acm.DEFAULTS["SNAPSHOT_BASE"], key) files.save_file(acm.DEFAULTS["SNAPSHOT_BASE"], key, a) self.assertEqual(a, files.read_file(acm.DEFAULTS["SNAPSHOT_BASE"], key))
def test_get_from_failover(self): c = acm.ACMClient(ENDPOINT, NAMESPACE, AK, SK) data_id = "com.alibaba.cloud.acm:sample-app.properties" group = "group" key = "+".join([data_id, group, NAMESPACE]) files.save_file(c.failover_base, key, "xxx") self.assertEqual(c.get(data_id, group), "xxx") shutil.rmtree(c.failover_base)
def test_get_from_snapshot(self): c = acm.ACMClient(ENDPOINT, NAMESPACE, AK, SK) c.server_list = [("1.100.84.215", 8080, True)] data_id = "com.alibaba.cloud.acm:sample-app.properties" group = "group" key = "+".join([data_id, group, NAMESPACE]) files.save_file(c.snapshot_base, key, "yyy") self.assertEqual(c.get(data_id, group), "yyy") shutil.rmtree(c.snapshot_base)