Description
The scaffolded test in
nautobot_controller_test.go creates a Nautobot CR without setting nautobotSecretRef and expects Reconcile to succeed. It fails with:
failed to get nautobot auth token {"error": "nautobotSecretRef "" is missing a namespace"}
Steps to Reproduce
make test
The failing test is:
Nautobot Controller When reconciling a resource [It] should successfully reconcile the resource
nautobot_controller_test.go:79
Root Cause
The test creates a bare Nautobot CR with no spec fields populated:
resource := &syncv1alpha1.Nautobot{
ObjectMeta: metav1.ObjectMeta{
Name: resourceName,
Namespace: "default",
},
}
When Reconcile runs, it reaches getAuthTokenFromSecretRef which requires nautobotSecretRef.Name and nautobotSecretRef.Namespace to be set.
Expected Fix
Provide a valid nautobotSecretRef — create a Secret in the test namespace and reference it in the CR spec
Description
The scaffolded test in
nautobot_controller_test.gocreates a Nautobot CR without setting nautobotSecretRef and expects Reconcile to succeed. It fails with:failed to get nautobot auth token {"error": "nautobotSecretRef "" is missing a namespace"}
Steps to Reproduce
make testThe failing test is:
Nautobot Controller When reconciling a resource [It] should successfully reconcile the resource
nautobot_controller_test.go:79
Root Cause
The test creates a bare Nautobot CR with no spec fields populated:
When Reconcile runs, it reaches getAuthTokenFromSecretRef which requires nautobotSecretRef.Name and nautobotSecretRef.Namespace to be set.
Expected Fix
Provide a valid nautobotSecretRef — create a Secret in the test namespace and reference it in the CR spec