Skip to content

Commit

Permalink
Move version validation tests into separate package
Browse files Browse the repository at this point in the history
This commit cleans up tests in pkg/apis/version by moving them
into a separate package. This encourages black-box testing.
No functional changes.
  • Loading branch information
lbernick committed Aug 12, 2022
1 parent bf8be59 commit 91653f0
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions pkg/apis/version/version_validation_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,14 @@ See the License for the specific language governing permissions and
limitations under the License.
*/

package version
package version_test

import (
"context"
"testing"

"github.com/tektoncd/pipeline/pkg/apis/config"
"github.com/tektoncd/pipeline/pkg/apis/version"
)

func TestValidateEnabledAPIFields(t *testing.T) {
Expand All @@ -35,7 +36,7 @@ func TestValidateEnabledAPIFields(t *testing.T) {
FeatureFlags: flags,
}
ctx := config.ToContext(context.Background(), cfg)
if err := ValidateEnabledAPIFields(ctx, "test feature", version); err != nil {
if err := version.ValidateEnabledAPIFields(ctx, "test feature", version); err != nil {
t.Errorf("unexpected error for compatible feature gates: %q", err)
}
}
Expand All @@ -51,7 +52,7 @@ func TestValidateEnabledAPIFieldsError(t *testing.T) {
FeatureFlags: flags,
}
ctx := config.ToContext(context.Background(), cfg)
err = ValidateEnabledAPIFields(ctx, "test feature", "alpha")
err = version.ValidateEnabledAPIFields(ctx, "test feature", "alpha")

if err == nil {
t.Errorf("error expected for incompatible feature gates")
Expand Down

0 comments on commit 91653f0

Please sign in to comment.