Add Unit Testing for V1 Nix Config - Go Protocol Buffer Plugins
Overview
Implement comprehensive unit testing using nix-unit to ensure our Go protocol buffer configuration maintains a consistent public interface and correctly maps to protoc plugin names.
Requirements
Core Testing Goals
- Verify that public interface remains stable across changes
- Ensure plugin names match their corresponding protoc-gen plugin names
- Test all configurable values for Go protocol buffer plugins
Plugin Configuration Testing
Each protoc-gen plugin must be testable for:
- Enablement: Each plugin should have an
enable flag that can be toggled
- Package Override: Each plugin should allow package redefinition for custom implementations
Implementation Details
Testing Framework
Use nix-unit with flake-parts integration:
perSystem = { ... }: {
nix-unit.inputs = {
# NOTE: nixpkgs-lib follows rule is currently required
inherit (inputs) nixpkgs flake-parts nix-unit;
};
# Tests for Go protoc plugins
nix-unit.tests = {
# Test plugin enablement (default: disabled)
"protoc-gen-go-enable" = {
expr = self.mkBufrnixPackage.go.enable;
expected = false;
};
# Test default package assignment
"protoc-gen-go-package" = {
expr = self.mkBufrnixPackage.go.package;
expected = pkgs.protoc-gen-go;
};
# Additional plugin tests would follow the same pattern:
# "protoc-gen-go-grpc-enable" = { ... };
# "protoc-gen-go-grpc-package" = { ... };
};
};
Test Coverage Requirements
Each test should validate:
- Plugin Name Mapping: Test values should correspond to actual protoc plugin names
- Default State: Plugins should be disabled by default (
enable = false)
- Package Resolution: Default packages should point to correct nixpkgs derivations
- Interface Consistency: Public API should remain stable
Acceptance Criteria
Additional Notes
This testing infrastructure will serve as a foundation for ensuring backward compatibility and preventing regressions in the public interface of our Nix Go configuration.
Add Unit Testing for V1 Nix Config - Go Protocol Buffer Plugins
Overview
Implement comprehensive unit testing using
nix-unitto ensure our Go protocol buffer configuration maintains a consistent public interface and correctly maps to protoc plugin names.Requirements
Core Testing Goals
Plugin Configuration Testing
Each
protoc-genplugin must be testable for:enableflag that can be toggledImplementation Details
Testing Framework
Use
nix-unitwithflake-partsintegration:Test Coverage Requirements
Each test should validate:
enable = false)Acceptance Criteria
Additional Notes
This testing infrastructure will serve as a foundation for ensuring backward compatibility and preventing regressions in the public interface of our Nix Go configuration.