Skip to content

Commit b54b123

Browse files
authored
Merge pull request #7 from xebialabs-community/rollbackDatabase
Adding an automated test for rollback database
2 parents fd89f13 + c7cbda7 commit b54b123

File tree

5 files changed

+19
-18
lines changed

5 files changed

+19
-18
lines changed

build.gradle

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,8 @@ if (!project.hasProperty('jythonInterpreter')) {
3535
project.ext['jythonInterpreter'] = "jython"
3636
}
3737

38-
sourceSets.main.resources.srcDirs = ["src/main/jython", "src/main/resources"]
39-
sourceSets.test.resources.srcDirs = ["src/test/jython", "src/test/resources"]
38+
// sourceSets.main.resources.srcDirs = ["src/main/jython", "src/main/resources"]
39+
// sourceSets.test.resources.srcDirs = ["src/test/jython", "src/test/resources"]
4040

4141

4242
task testJython(type: Exec, dependsOn: ['testClasses']) {

src/main/resources/delphix/DelphixClient.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,4 +69,7 @@ def delphix_refreshdatabase(self, variables):
6969
return database.refresh(self.engine, variables['vdb'], None)
7070

7171
def delphix_syncdatabase(self, variables):
72-
return database.sync(self.engine, variables['vdb'], None)
72+
return database.sync(self.engine, variables['vdb'], None)
73+
74+
def delphix_rollbackdatabase(self, variables):
75+
return database.rollback(self.engine, variables['vdb'], None)

src/main/resources/synthetic.xml

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -51,13 +51,8 @@
5151
<property name="vdb" category="input"/>
5252
</type>
5353

54-
<type type="delphix.Rewind" extends="delphix.Task">
55-
54+
<type type="delphix.rollbackDatabase" extends="delphix.Task">
5655
<property name="vdb" category="input"/>
57-
58-
<property name="job" category="output" required="false"/>
59-
<property name="action" category="output" required="false"/>
60-
6156
</type>
6257

6358

src/main/resources/delphix/Rewind.py renamed to src/test/jython/itests/Database_rollback_test.py

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -8,16 +8,18 @@
88
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
99
#
1010

11-
if __name__ == '__main__':
12-
import sys
1311

14-
sys.path.append('/Users/bmoussaud/Workspace/xebialabs-community/xlr-delphix-plugin/src/main/resources')
15-
server = {'url': 'http://ba5b5824.ngrok.io', 'username': 'delphix_admin', 'password': 'landshark'}
16-
vdb = 'XEBIA'
1712

13+
import unittest
14+
from itests import DelphixServerCi
1815
from delphix.DelphixClient import DelphixClient
16+
from delphix.lib.DlpxException import DlpxException
1917

20-
client = DelphixClient(server)
21-
output = client.rewind(vdb)
22-
job = output['job']
23-
action = output['action']
18+
19+
class RollbackDatabase(unittest.TestCase):
20+
21+
22+
def test_rollback_database(self):
23+
client = DelphixClient.create_client(DelphixServerCi())
24+
variables = {"vdb": "somevirtualdatabase" }
25+
client.delphix_rollbackdatabase(variables)

src/test/resources/docker/delphix/main.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ func main() {
1919
router := mux.NewRouter().StrictSlash(true)
2020
router.HandleFunc("/resources/json/delphix/database/{ref_id}/refresh", ReturnDatabaseResponse).Methods("POST")
2121
router.HandleFunc("/resources/json/delphix/database/{ref_id}/sync", ReturnDatabaseResponse).Methods("POST")
22+
router.HandleFunc("/resources/json/delphix/database/{ref_id}/rollback", ReturnDatabaseResponse).Methods("POST")
2223

2324
router.HandleFunc("/resources/json/delphix/login", ReturnLoginResponse).Methods("POST")
2425

0 commit comments

Comments
 (0)