首页 > 解决方案 > Zendesk API - 是否可以同时编辑 2 个单独的类别?

问题描述

我有一些可与 Zendesk 帮助中心配合使用的自动化测试,并且我创建了一个 Jenkins 作业,它会在我在项目中推送一些新更改后的某个时间自动运行测试。这些测试使用相同的凭据连接到同一个 Zendesk 主机。

现在,有时我还想在我的 PC 上运行测试,同时它们在 Jenkins 上运行。当测试在本地运行时,我创建一个类别和一个名称为Local CategoryLocal Section的部分。当它们在 Jenkins 上运行时,名称更改为Jenkins CategoryJenkins Section。我这样做是希望测试能够运行而不会发生冲突。

这是代码:

 protected void createTestCategoryAndSection() {
    boolean isOnJenkins = System.getenv("JENKINS_HOME") != null;
    category = zendeskRepoMngr.createCategory(
        isOnJenkins ? "Jenkins Test Category 1" : "Local Test Category 1",
        "Category created by a test case run " + (isOnJenkins ? "on Jenkins" : "locally"),
        1);
    section = zendeskRepoMngr.createSection(
        category.getId(),
        isOnJenkins ? "Jenkins Test Section 1" : "Local Test Section 1",
        "Section created by a test case run " + (isOnJenkins ? "on Jenkins" : "locally"),
        1);
  }

但是,当我运行我的测试(创建新文章,可能会更新这些文章,删除其中一些)时,我会收到以下错误:

HTTP/503: Service Unavailable - {"message":"Service is temporarily unavailable because of a concurrent update. Please try again."}

或者

HTTP/409: Conflict - {"error":"Conflict","description":"Could not access data due to it being locked by another client"}

甚至

HTTP/500: Internal Server Error - {"status":500,"error":"Internal Server Error"}

有没有办法在本地和 Jenkins 上运行自动化测试,连接到同一个 Zendesk 主机并使用相同的凭据?

标签: zendeskzendesk-api

解决方案


推荐阅读