Skip to content

Commit

Permalink
fix rate limiting setting in test setup
Browse files Browse the repository at this point in the history
  • Loading branch information
Patrick Huang authored and kgough committed Sep 4, 2017
1 parent 9701e42 commit 799c907
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 15 deletions.
1 change: 0 additions & 1 deletion server/functional-test/pom.xml
Expand Up @@ -60,7 +60,6 @@

<zanata.instance.url>http://${cargo.host}:${cargo.servlet.port}/${context.path}</zanata.instance.url>
<zanata.apikey>b6d7044e9ee3b2447c28fb7c50d86d98</zanata.apikey>
<zanata.admin.username>admin</zanata.admin.username>
<zanata.translatorkey>d83882201764f7d339e97c4b087f0806</zanata.translatorkey>
<zanata.sample.projects.basedir>${project.build.testOutputDirectory}/sample-projects</zanata.sample.projects.basedir>

Expand Down
Expand Up @@ -24,7 +24,9 @@
import javax.ws.rs.client.Entity;
import javax.ws.rs.client.Invocation;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;

import org.assertj.core.api.Assertions;
import org.jboss.resteasy.client.jaxrs.ResteasyClientBuilder;
import org.zanata.model.HApplicationConfiguration;

Expand Down Expand Up @@ -99,31 +101,31 @@ public static void setRateLimit(int active, int concurrent)
String restUrl = PropertiesHolder.getProperty(Constants.zanataInstance
.value()) + "rest/configurations/c/";

new ResteasyClientBuilder().build()
Response response = new ResteasyClientBuilder().build()
.target(restUrl +
HApplicationConfiguration.KEY_MAX_ACTIVE_REQ_PER_API_KEY)
HApplicationConfiguration.KEY_MAX_ACTIVE_REQ_PER_API_KEY)
.queryParam("configValue", active)
.request(MediaType.APPLICATION_XML_TYPE)
.header("X-Auth-Token",
PropertiesHolder.getProperty(Constants.zanataApiKey
.value()))
.header("X-Auth-User",
PropertiesHolder.getProperty(Constants.zanataAdminUser
.value()))
.put(null).close();
.header("X-Auth-User", "admin")
.put(null);
Assertions.assertThat(response.getStatus()).isLessThan(300);
response.close();

new ResteasyClientBuilder().build()
response = new ResteasyClientBuilder().build()
.target(restUrl +
HApplicationConfiguration.KEY_MAX_CONCURRENT_REQ_PER_API_KEY)
HApplicationConfiguration.KEY_MAX_CONCURRENT_REQ_PER_API_KEY)
.queryParam("configValue", concurrent)
.request(MediaType.APPLICATION_XML_TYPE)
.header("X-Auth-Token",
PropertiesHolder.getProperty(Constants.zanataApiKey
.value()))
.header("X-Auth-User",
PropertiesHolder.getProperty(Constants.zanataAdminUser
.value()))
.put(null).close();
.header("X-Auth-User", "admin")
.put(null);
Assertions.assertThat(response.getStatus()).isLessThan(300);
response.close();
}

public static void makeSampleLanguages() throws Exception {
Expand Down
Expand Up @@ -31,8 +31,8 @@
* <a href="mailto:pahuang@redhat.com">pahuang@redhat.com</a>
*/
public class SampleDataRule extends ExternalResource {
public static final int CONCURRENT_RATE_LIMIT = 1000;
public static final int ACTIVE_RATE_LIMIT = 2;
public static final int CONCURRENT_RATE_LIMIT = 20;
public static final int ACTIVE_RATE_LIMIT = 10;

@Override
public void before() throws Throwable {
Expand Down

0 comments on commit 799c907

Please sign in to comment.