Issue the provisioner client its own account when its module declares no broker
The catalogue's mesh-provisioner-client declares only provisioner-broker: the client speaks on the bus as itself. module issue refused it for lacking a broker, assign minted nothing, and push refused it for lacking an account, so no machine could run the client (issue 917).
This commit is contained in:
@@ -2,6 +2,7 @@ package main
|
||||
|
||||
import (
|
||||
"slices"
|
||||
"strings"
|
||||
"testing"
|
||||
|
||||
"github.com/novox/mesh-controller/internal/broker"
|
||||
@@ -60,3 +61,32 @@ func TestTheProvisionerClientsAccountIsIssuedForItsServiceAndNeverInvented(t *te
|
||||
t.Fatal("a module with nowhere to read the client's account is read as running it")
|
||||
}
|
||||
}
|
||||
|
||||
// A module that runs the client and declares no broker of its own, as the catalogue's mesh-provisioner-client does,
|
||||
// may be issued: the client's account alone (issue 917). Before, `module issue` refused it for having no broker,
|
||||
// while a push refused it for having no account, so no machine could run the client.
|
||||
func TestAClientWithoutABrokerOfItsOwnMayBeIssued(t *testing.T) {
|
||||
if err := mayIssue(aClientModule()); err != nil {
|
||||
t.Fatalf("the client alone is refused an account: %v", err)
|
||||
}
|
||||
neither := aBot("bot", false)
|
||||
if err := mayIssue(neither); err == nil {
|
||||
t.Fatal("a module with nowhere to read any account may be issued one")
|
||||
}
|
||||
}
|
||||
|
||||
// Assigning the client tries to issue the client's account, as assigning any module issues its broker (issue 917):
|
||||
// without a bus to issue on, the line says so and names the verb, never nothing.
|
||||
func TestAssigningTheClientIssuesItsAccount(t *testing.T) {
|
||||
open := aMesh(t)
|
||||
ctx := t.Context()
|
||||
client := aClientModule()
|
||||
register(t, open, client)
|
||||
out, err := assign(ctx, open, "laptop", client.Module)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if !strings.Contains(out, "bus credential") {
|
||||
t.Fatalf("assigning the client said nothing of its account:\n%s", out)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user