adm: Refactor morph
command #950
No reviewers
Labels
No labels
P0
P1
P2
P3
badger
frostfs-adm
frostfs-cli
frostfs-ir
frostfs-lens
frostfs-node
good first issue
triage
Infrastructure
blocked
bug
config
discussion
documentation
duplicate
enhancement
go
help wanted
internal
invalid
kludge
observability
perfomance
question
refactoring
wontfix
No milestone
No project
No assignees
4 participants
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference: TrueCloudLab/frostfs-node#950
Loading…
Add table
Reference in a new issue
No description provided.
Delete branch "acid-ant/frostfs-node:feature/932-nns-register-renew"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Move
morph
sub commands to separate packages.Tested with
dev-env
.Signed-off-by: Anton Nikiforov an.nikiforov@yadro.com
5611a784c3
to9fc1f43fab
WIP: adm: Refactorto adm: Refactormorph
commandmorph
command@ -0,0 +122,4 @@
r := tar.NewReader(gr)
for h, err := r.Next(); ; h, err = r.Next() {
if err != nil {
[Optional request change]
This doesn't mean everything was OK and
tgz
has been successully read.How about to slightly change like that:
WDYT? :)
Sound like
Good First Issue
!Created #951 for tracking.
@ -0,0 +126,4 @@
break
}
dir, _ := filepath.Split(h.Name)
It seems the loop-body considers only regular files. I am sure it works fine but let's make it safer:
This check (above
dir, _ := filepath.Split(h.Name)
) would be OK:Created #951 for tracking.
@ -0,0 +10,4 @@
"strings"
"text/tabwriter"
"git.frostfs.info/TrueCloudLab/frostfs-node/cmd/frostfs-adm/internal/modules/morph/util"
Can we avoid having this generic package?
There are client helpers, which could be put separately, there are NNS-related routines, which could be moved too.
I'm planning to add these changes in the next iteration, don't want to change current implementation. Add comment here.
@ -0,0 +4,4 @@
"fmt"
"strings"
util2 "git.frostfs.info/TrueCloudLab/frostfs-node/cmd/frostfs-adm/internal/modules/morph/util"
Why use alias?
Thanks, removed.
@ -0,0 +11,4 @@
Use: "netmap-candidates",
Short: "List netmap candidates nodes",
PreRun: func(cmd *cobra.Command, _ []string) {
_ = viper.BindPFlag(util.EndpointFlag, cmd.Flags().Lookup(util.EndpointFlag))
Again, can we move flag definitions to sth like
commonflags
package like we have for CLI?Moved flags to package
adm\internal\commonflags
,const
to packageconstants
. Also renamedutil
tohelper
to avoid conflicts with other imports.@ -0,0 +48,4 @@
testInitialize(t, 16)
})
t.Run("max nodes", func(t *testing.T) {
testInitialize(t, util.MaxAlphabetNodes)
Besides dev-env, we should run
TestInitialize
(remove temporarilyt.Skip()
)Thanks, missed that. All tests were passed.
multinodes tests too?
Yes, all tests in
TestInitialize
were passed.760a2daa17
to0dfe44b7bd
0dfe44b7bd
tob8631996a7
b8631996a7
tod90703f9b0
d90703f9b0
to860b548c4f
860b548c4f
toed5ea3d468
ed5ea3d468
tob7f476f970
b7f476f970
to034fbf5716
034fbf5716
to74cfe98a6c
74cfe98a6c
to08b0b1be24
08b0b1be24
to802192cfef
@ -0,0 +9,4 @@
// MaxAlphabetNodes is the maximum number of candidates allowed, which is currently limited by the size
// of the invocation script.
// See: https://github.com/nspcc-dev/neo-go/blob/740488f7f35e367eaa99a71c0a609c315fe2b0fc/pkg/core/transaction/witness.go#L10
MaxAlphabetNodes = 22
It is used in multiple packages?
It is used in multiple packages?
Yes, it is used in
helper
,generate
andinitialize
.@ -0,0 +154,4 @@
v.Set("credentials.contract", constants.TestContractPassword)
}
func TestNextPollInterval(t *testing.T) {
This test no longer belongs here, should be in
helper
package.Thanks, moved to
helper
.@ -0,0 +8,4 @@
"github.com/nspcc-dev/neo-go/pkg/wallet"
)
func AddManifestGroup(cw *wallet.Wallet, h util.Uint160, cs *ContractState) error {
It is used in multiple packages?
Yes, in
contract
andinitialize
TestNextPollInterval
to packagehelper