Skip to content

Commit 8ff34f2

Browse files
committed
Adding an automated test for sync database
1 parent 19e680c commit 8ff34f2

File tree

4 files changed

+19
-18
lines changed

4 files changed

+19
-18
lines changed

src/main/resources/delphix/DelphixClient.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,3 +67,6 @@ def delphix_deletebookmark(self, variables):
6767

6868
def delphix_refreshdatabase(self, variables):
6969
return database.refresh(self.engine, variables['vdb'], None)
70+
71+
def delphix_syncdatabase(self, variables):
72+
return database.sync(self.engine, variables['vdb'], None)

src/main/resources/synthetic.xml

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -47,13 +47,8 @@
4747
<property name="vdb" category="input" description="Reference to a container (vdb) object" />
4848
</type>
4949

50-
<type type="delphix.Snapshot" extends="delphix.Task">
51-
50+
<type type="delphix.syncDatabase" extends="delphix.Task">
5251
<property name="vdb" category="input"/>
53-
54-
<property name="job" category="output" required="false"/>
55-
<property name="action" category="output" required="false"/>
56-
5752
</type>
5853

5954
<type type="delphix.Rewind" extends="delphix.Task">

src/main/resources/delphix/Snapshot.py renamed to src/test/jython/itests/Database_sync_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.snapshot(vdb)
22-
job = output['job']
23-
action = output['action']
18+
19+
class SyncDatabase(unittest.TestCase):
20+
21+
22+
def test_sync_database(self):
23+
client = DelphixClient.create_client(DelphixServerCi())
24+
variables = {"vdb": "somevirtualdatabase" }
25+
client.delphix_syncdatabase(variables)

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

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,8 @@ type DelphixResponse struct {
1717

1818
func main() {
1919
router := mux.NewRouter().StrictSlash(true)
20-
router.HandleFunc("/resources/json/delphix/database/{ref_id}/refresh", ReturnDatabaseRefreshResponse).Methods("POST")
20+
router.HandleFunc("/resources/json/delphix/database/{ref_id}/refresh", ReturnDatabaseResponse).Methods("POST")
21+
router.HandleFunc("/resources/json/delphix/database/{ref_id}/sync", ReturnDatabaseResponse).Methods("POST")
2122

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

@@ -30,8 +31,8 @@ func main() {
3031
log.Fatal(http.ListenAndServe(":8080", router))
3132
}
3233

33-
// ReturnDatabaseRefreshResponse sends a dummy response back
34-
func ReturnDatabaseRefreshResponse(res http.ResponseWriter, req *http.Request) {
34+
// ReturnDatabaseResponse sends a dummy response back
35+
func ReturnDatabaseResponse(res http.ResponseWriter, req *http.Request) {
3536
res.Header().Set("Content-Type", "application/json")
3637
b := json.RawMessage(`{
3738
"type":"OKResult",

0 commit comments

Comments
 (0)