-
Notifications
You must be signed in to change notification settings - Fork 102
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Added spock test cases for Repose #968
Conversation
ac8ce37
to
174a23f
Compare
spock-tests/pom.xml
Outdated
<url>http://blueflood.io</url> | ||
|
||
<dependencies> | ||
<!-- Spock Framework --> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wouldn't it be better to add groovy and spock to the entire project? That way we can write spock tests anywhere in the future.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
DOne
@Shared | ||
String tenantId = System.getenv("TENANT_ID") | ||
@Shared | ||
String authToken = System.getenv("AUTH_TOKEN") | ||
String envToRun = System.getenv("ENV_TO_RUN")?.toLowerCase() ?: "stage" | ||
static def defaultRateLimit = Integer.parseInt(System.getenv("RATE_LIMIT_COUNT") ?: "0") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Inconsistent. These four values are effectively user options. You have two set as @Shared
, one static, and one just a normal test property. That makes a reader think they have different purposes or uses. It looks like they should all be @Shared
and final
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
DOne...defaultRateLimit need to be static because it is getting used in loop in where clause of test and it should be @shared and static to be accessible
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Well, for that matter, there's not much reason all of these couldn't be static
and final
. It would convey more information about their usage.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
spock-tests/src/test/groovy/com/rackspacecloud/blueflood/repose/ReposeSpec.groovy
Outdated
Show resolved
Hide resolved
spock-tests/src/test/groovy/com/rackspacecloud/blueflood/repose/ReposeSpec.groovy
Outdated
Show resolved
Hide resolved
spock-tests/src/test/groovy/com/rackspacecloud/blueflood/repose/ReposeSpec.groovy
Outdated
Show resolved
Hide resolved
174a23f
to
710629e
Compare
710629e
to
34ad04d
Compare
blueflood-spock-tests/pom.xml
Outdated
<artifactId>blueflood-spock-tests</artifactId> | ||
<name>Blueflood Spock Tests</name> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wait, isn't this module for repose tests? We wouldn't put all possibly spock-based unit tests in this module.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
renamed to Repose
blueflood-spock-tests/pom.xml
Outdated
<dependency> | ||
<groupId>org.spockframework</groupId> | ||
<artifactId>spock-core</artifactId> | ||
</dependency> | ||
|
||
<dependency> | ||
<groupId>org.spockframework</groupId> | ||
<artifactId>spock-junit4</artifactId> | ||
</dependency> | ||
|
||
<dependency> | ||
<groupId>org.apache.groovy</groupId> | ||
<artifactId>groovy-all</artifactId> | ||
</dependency> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I didn't mean to just add dependency management of these things at the top level. I meant add them as test dependencies of the entire project, so that spock tests can be written anywhere. That would have to include the groovy compiler plugin, too.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
DOne
pom.xml
Outdated
<dependency> | ||
<groupId>org.apache.groovy</groupId> | ||
<artifactId>groovy-all</artifactId> | ||
<version>4.0.16</version> | ||
</dependency> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should also be test scope, right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
DOne
@Shared | ||
static final def defaultRateLimit = Integer.parseInt(System.getenv("RATE_LIMIT_COUNT") ?: "0") | ||
|
||
def httpClient = HttpClients.createDefault() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Isn't this also @Shared
and final
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
DOne
@Shared | ||
String tenantId = System.getenv("TENANT_ID") | ||
@Shared | ||
String authToken = System.getenv("AUTH_TOKEN") | ||
String envToRun = System.getenv("ENV_TO_RUN")?.toLowerCase() ?: "stage" | ||
static def defaultRateLimit = Integer.parseInt(System.getenv("RATE_LIMIT_COUNT") ?: "0") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Well, for that matter, there's not much reason all of these couldn't be static
and final
. It would convey more information about their usage.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looking better, but this needs a README in the new module explaining what it's for and how to use it. Possibly mention it in the top-level README, too.
34ad04d
to
8cd3089
Compare
While upgrading repose, we found out that no test case exist for Repose and we decided to write it using spock framework.
8cd3089
to
bc89c1b
Compare
These changes are moved to new project bluflood-repose-tests. |
While upgrading repose, we found out that no test case exist for Repose and we decided to write it using spock framework.