threefoldtech / tfgrid-sdk-go

Apache License 2.0
2 stars 4 forks source link

add validation to the client's Network Deployer to check for nodes #1150

Closed eyad-hussein closed 1 month ago

eyad-hussein commented 3 months ago

Is your feature request related to a problem? Please describe

When using the grid client to deploy a network without assigning node ids to the Znet workload beforehand, no errors are returned the validation passes except that nothing is actually deployed in the grid.


Client := deployer.NewTFPluginClient(mnemonic, deployer.WithNetwork(net))

// Nodes field is not assigned a value
network := &workloads.ZNet{
          Name: networkName,
          IPRange: gridtypes.NewIPNet(net.IPNet{
              IP:   net.IPv4(10, 20, 0, 0),
              Mask: net.CIDRMask(16, 32),
          }),
          AddWGAccess: false,
}

// Expected behavior: an error to be returned
// Actual behavior: no error is returned and network is not actually deployed
if err := Client.NetworkDeployer.Deploy(ctx, network); err != nil {
    return err
}

Describe the solution you'd like

Add thorough validation when deploying a network to the grid.