]> git.proxmox.com Git - ceph.git/blobdiff - ceph/src/pybind/mgr/dashboard/frontend/src/app/shared/api/cephfs.service.spec.ts
import 15.2.0 Octopus source
[ceph.git] / ceph / src / pybind / mgr / dashboard / frontend / src / app / shared / api / cephfs.service.spec.ts
index 882f7c58dab7478add97ffe9b4aad6d8b8f00fdd..a71e67a519c20aca12af376a79a56b3558157488 100644 (file)
@@ -44,9 +44,55 @@ describe('CephfsService', () => {
     expect(req.request.method).toBe('GET');
   });
 
+  it('should call getTabs', () => {
+    service.getTabs(2).subscribe();
+    const req = httpTesting.expectOne('ui-api/cephfs/2/tabs');
+    expect(req.request.method).toBe('GET');
+  });
+
   it('should call getMdsCounters', () => {
-    service.getMdsCounters(1).subscribe();
+    service.getMdsCounters('1').subscribe();
     const req = httpTesting.expectOne('api/cephfs/1/mds_counters');
     expect(req.request.method).toBe('GET');
   });
+
+  it('should call lsDir', () => {
+    service.lsDir(1).subscribe();
+    const req = httpTesting.expectOne('ui-api/cephfs/1/ls_dir?depth=2');
+    expect(req.request.method).toBe('GET');
+    service.lsDir(2, '/some/path').subscribe();
+    httpTesting.expectOne('ui-api/cephfs/2/ls_dir?depth=2&path=%252Fsome%252Fpath');
+  });
+
+  it('should call mkSnapshot', () => {
+    service.mkSnapshot(3, '/some/path').subscribe();
+    const req = httpTesting.expectOne('api/cephfs/3/mk_snapshot?path=%252Fsome%252Fpath');
+    expect(req.request.method).toBe('POST');
+
+    service.mkSnapshot(4, '/some/other/path', 'snap').subscribe();
+    httpTesting.expectOne('api/cephfs/4/mk_snapshot?path=%252Fsome%252Fother%252Fpath&name=snap');
+  });
+
+  it('should call rmSnapshot', () => {
+    service.rmSnapshot(1, '/some/path', 'snap').subscribe();
+    const req = httpTesting.expectOne('api/cephfs/1/rm_snapshot?path=%252Fsome%252Fpath&name=snap');
+    expect(req.request.method).toBe('POST');
+  });
+
+  it('should call updateQuota', () => {
+    service.updateQuota(1, '/some/path', { max_bytes: 1024 }).subscribe();
+    let req = httpTesting.expectOne('api/cephfs/1/set_quotas?path=%252Fsome%252Fpath');
+    expect(req.request.method).toBe('POST');
+    expect(req.request.body).toEqual({ max_bytes: 1024 });
+
+    service.updateQuota(1, '/some/path', { max_files: 10 }).subscribe();
+    req = httpTesting.expectOne('api/cephfs/1/set_quotas?path=%252Fsome%252Fpath');
+    expect(req.request.method).toBe('POST');
+    expect(req.request.body).toEqual({ max_files: 10 });
+
+    service.updateQuota(1, '/some/path', { max_bytes: 1024, max_files: 10 }).subscribe();
+    req = httpTesting.expectOne('api/cephfs/1/set_quotas?path=%252Fsome%252Fpath');
+    expect(req.request.method).toBe('POST');
+    expect(req.request.body).toEqual({ max_bytes: 1024, max_files: 10 });
+  });
 });