nautobot_controller_test.go reconcile test fails — missing nautobotSecretRef setup

Open Beginner friendly
#2,193 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
78/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Quiet
Tech stack
go, kubernetes
Domain
backend, testing

Research direction

Start in nautobot_controller_test.go at the failing reconcile test around line 79, and run make test to reproduce it. Create a Secret in the test namespace and set the Nautobot CR's nautobotSecretRef to reference it; the test is done when reconciliation succeeds.

Written by the indexing model from the issue text.

Description

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

Dominant language
Python
Stars
13
Forks
12
Avg merge
1d 9h
Merged PRs (30d)
73

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from rackerlabs/understack

All issues in rackerlabs/understack

Similar issues

More Python issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.