clouWay Cloud Datastore Testing Library

clouWay Datastore Testing Library

License

License

Categories

Categories

Data
GroupId

GroupId

com.clouway.testing
ArtifactId

ArtifactId

cloud-datastore-testing
Last Version

Last Version

0.0.3
Release Date

Release Date

Type

Type

jar
Description

Description

clouWay Cloud Datastore Testing Library
clouWay Datastore Testing Library
Project URL

Project URL

https://github.com/clouway/cloud-datastore-testing
Source Code Management

Source Code Management

https://github.com/clouway/cloud-datastore-testing

Download cloud-datastore-testing

How to add to project

<!-- https://jarcasting.com/artifacts/com.clouway.testing/cloud-datastore-testing/ -->
<dependency>
    <groupId>com.clouway.testing</groupId>
    <artifactId>cloud-datastore-testing</artifactId>
    <version>0.0.3</version>
</dependency>
// https://jarcasting.com/artifacts/com.clouway.testing/cloud-datastore-testing/
implementation 'com.clouway.testing:cloud-datastore-testing:0.0.3'
// https://jarcasting.com/artifacts/com.clouway.testing/cloud-datastore-testing/
implementation ("com.clouway.testing:cloud-datastore-testing:0.0.3")
'com.clouway.testing:cloud-datastore-testing:jar:0.0.3'
<dependency org="com.clouway.testing" name="cloud-datastore-testing" rev="0.0.3">
  <artifact name="cloud-datastore-testing" type="jar" />
</dependency>
@Grapes(
@Grab(group='com.clouway.testing', module='cloud-datastore-testing', version='0.0.3')
)
libraryDependencies += "com.clouway.testing" % "cloud-datastore-testing" % "0.0.3"
[com.clouway.testing/cloud-datastore-testing "0.0.3"]

Dependencies

compile (4)

Group / Artifact Type Version
org.jetbrains.kotlin : kotlin-stdlib-jdk8 jar 1.4.10
org.testcontainers : testcontainers jar 1.15.0-rc2
com.google.cloud : google-cloud-datastore jar 1.105.0
junit : junit jar 4.12

Project Modules

There are no modules declared in this project.

Cloud Datastore Testing Package

A testing package of cloud-datastore.

Adding as dependency

In Gradle:

repositories {
  mavenCentral()
}

dependencies {
     compile 'com.clouway.testing:cloud-datastore-testing:0.0.1'
}

In Maven:

 <dependency>
    <groupId>com.clouway.testing</groupId>
    <artifactId>cloud-datastore-testing</artifactId>
    <version>0.0.1</version>
 </dependency>

Usage

  • Unit Testing with JUnit 4.x
  @Rule
  @JvmField
  val context = JUnitRuleMockery()

  companion object {
    @ClassRule
    @JvmField
    val datastoreRule = DatastoreRule()
  }

  @Rule
  @JvmField
  var cleaner = DatastoreCleaner { datastoreRule.port }

  // ....
   
  @Test
  fun happyPath() {
    val datastore = datastoreRuel.datastore
    // do datastore persistent logic
  }
   
  • Jenkins CI Usage
    As cloud-datastore-testing library is using docker for running of the emulator it is required the following environment variables to be passed from the CI:
  export DATASTORE_HOST=xxxx
  export DATASTORE_PORT=5000

Here is a complete Jenkins example:

docker.image('google/cloud-sdk:latest').withRun('--entrypoint gcloud', 'beta emulators datastore start --no-legacy --project testing --host-port=0.0.0.0:8888 --consistency=1 --no-store-on-disk') { c ->
   docker.image('yourimage').inside("-e CI=true -e DATASTORE_HOST=datastore -e DATASTORE_PORT=8888 --link ${c.id}:datastore") {
       // perform your test execution here  
   }
}

Contributing

If you would like to contribute code to pcache client you can do so through GitHub by forking the repository and sending a pull request. When submitting code, please make every effort to follow existing conventions and style in order to keep the code as readable as possible. Please also make sure your code compiles by running gradle clean build.

com.clouway.testing

clouWay ood

Versions

Version
0.0.3
0.0.2
0.0.1