dongmao7195 2014-05-12 23:07
浏览 24
已采纳

在测试期间控制最终的AppEngine数据存储区一致性

I have an AppEngine app written in Go, and I'm trying to improve my tests.

Part of the tests that I need to run are a series of create, update, delete queries on the same object. However given that the datastore is eventually consistent (these aren't child objects), I am currently stuck using a time.Sleep(time.Second * 5) to give the simulated datastore in the SDK enough time for consistency to propagate.

This results in tests that take a long time to run. How can I force something more like strong consistency for tests without rewriting my code to use ancestor queries?

  • 写回答

2条回答 默认 最新

  • duanniu4106 2015-09-22 14:27
    关注

    It's been a while, but the method that I found that works well is to call the context as follows:

    c, err := aetest.NewContext(&aetest.Options{StronglyConsistentDatastore: true})

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥15 微信会员卡接入微信支付商户号收款
  • ¥15 如何获取烟草零售终端数据
  • ¥15 数学建模招标中位数问题
  • ¥15 phython路径名过长报错 不知道什么问题
  • ¥15 深度学习中模型转换该怎么实现
  • ¥15 HLs设计手写数字识别程序编译通不过
  • ¥15 Stata外部命令安装问题求帮助!
  • ¥15 从键盘随机输入A-H中的一串字符串,用七段数码管方法进行绘制。提交代码及运行截图。
  • ¥15 TYPCE母转母,插入认方向
  • ¥15 如何用python向钉钉机器人发送可以放大的图片?