(t *testing.T)
| 17 | ) |
| 18 | |
| 19 | func TestOwn(t *testing.T) { |
| 20 | d, apiUrl := blobcached.BGTestDaemon(t) |
| 21 | env := map[string]string{ |
| 22 | bcclient.EnvBlobcacheAPI: apiUrl, |
| 23 | } |
| 24 | |
| 25 | // Get the node's peer ID to verify the output |
| 26 | nodePeerID, err := d.GetPeerID() |
| 27 | require.NoError(t, err) |
| 28 | |
| 29 | // Use a made-up peer ID for the owner |
| 30 | ownerPeerID := nodePeerID // reuse node's own ID as the owner for simplicity |
| 31 | |
| 32 | // Run the own command |
| 33 | out := runCmdGetOut(t, env, []string{"--state", d.StateDir.Name(), "own", ownerPeerID.String()}) |
| 34 | outStr := string(out) |
| 35 | t.Log(outStr) |
| 36 | |
| 37 | // Verify the output contains expected strings |
| 38 | require.Contains(t, outStr, "OWN") |
| 39 | require.Contains(t, outStr, "full access") |
| 40 | require.Contains(t, outStr, "ns create") |
| 41 | require.Contains(t, outStr, nodePeerID.String()[:8]) |
| 42 | |
| 43 | // Verify the peer was added to the admin group |
| 44 | pol, err := d.GetPolicy() |
| 45 | require.NoError(t, err) |
| 46 | rights := pol.OpenFiat(ownerPeerID, blobcache.OID{}) |
| 47 | require.NotZero(t, rights, "owner should have rights on the root volume") |
| 48 | } |
| 49 | |
| 50 | func TestGLFS(t *testing.T) { |
| 51 | stateDir := t.TempDir() |
nothing calls this directly
no test coverage detected