[#139] Refactor blobovnicza exists test to not use chmod #253

Merged
fyrchik merged 1 commit from ale64bit/frostfs-node:fix/139-refactor-blobovnicza-exists-test into master 2023-04-14 10:17:58 +00:00
3 changed files with 7 additions and 6 deletions

View file

@ -490,7 +490,7 @@ const (
NetmapCantInvokeNetmapUpdatePeer = "can't invoke netmap.UpdatePeer" // Error in ../node/pkg/innerring/processors/netmap/process_peers.go
NetmapNonAlphabetModeIgnoreRemoveNodeFromSubnetNotification = "non alphabet mode, ignore remove node from subnet notification" // Info in ../node/pkg/innerring/processors/netmap/process_peers.go
NetmapCouldNotGetNetworkMapCandidates = "could not get network map candidates" // Warn in ../node/pkg/innerring/processors/netmap/process_peers.go
NetmapCouldNotUnmarshalSubnetId = "could not unmarshal subnet id" // Warn in ../node/pkg/innerring/processors/netmap/process_peers.go
NetmapCouldNotUnmarshalSubnetID = "could not unmarshal subnet id" // Warn in ../node/pkg/innerring/processors/netmap/process_peers.go
Review

Can we do it in a separate commit?

Can we do it in a separate commit?
Review

no. The precommit won't let me. Not sure how it got through in the first place.

no. The precommit won't let me. Not sure how it got through in the first place.
NetmapGotZeroSubnetInRemoveNodeNotification = "got zero subnet in remove node notification" // Warn in ../node/pkg/innerring/processors/netmap/process_peers.go
NetmapCouldNotIterateOverSubnetworksOfTheNode = "could not iterate over subnetworks of the node" // Warn in ../node/pkg/innerring/processors/netmap/process_peers.go
NetmapCouldNotInvokeNetmapUpdateState = "could not invoke netmap.UpdateState" // Error in ../node/pkg/innerring/processors/netmap/process_peers.go

View file

@ -159,7 +159,7 @@ func (np *Processor) processRemoveSubnetNode(ev subnetEvent.RemoveNode) {
err = subnetToRemoveFrom.Unmarshal(rawSubnet)
if err != nil {
np.log.Warn(logs.NetmapCouldNotUnmarshalSubnetId,
np.log.Warn(logs.NetmapCouldNotUnmarshalSubnetID,
zap.Error(err),
)
return

View file

@ -53,10 +53,11 @@ func TestExistsInvalidStorageID(t *testing.T) {
t.Run("invalid storage id", func(t *testing.T) {
storageID := slice.Copy(putRes.StorageID)
storageID[0] = '9'
badDir := filepath.Join(dir, "9")
require.NoError(t, os.MkdirAll(badDir, os.ModePerm))
require.NoError(t, os.Chmod(badDir, 0))
t.Cleanup(func() { _ = os.Chmod(filepath.Join(dir, "9"), os.ModePerm) })
// An invalid boltdb file is created so that it returns an error when opened
badFileDir := filepath.Join(dir, "9", "0")
require.NoError(t, os.MkdirAll(badFileDir, os.ModePerm))
require.NoError(t, os.WriteFile(filepath.Join(badFileDir, "0"), []byte("not a boltdb file content"), 0777))
res, err := b.Exists(context.Background(), common.ExistsPrm{Address: addr, StorageID: storageID})
require.Error(t, err)