Skip to content

Commit d7984d0

Browse files
thc1006claude
andcommitted
fix(ci): ULTRA SPEED comprehensive fixes - iteration 7
🚀 MULTIPLE SPECIALIZED AGENTS COORDINATION: - deployment-engineer: Fixed Ginkgo CLI workflow with 2025 best practices - debugger: Fixed all remaining Go compilation and vet errors - search-specialist: Researched latest Ginkgo v2 CI patterns 🔧 GINKGO CLI WORKFLOW FIXES: - Added Ginkgo CLI installation with go install github.com/onsi/ginkgo/v2/ginkgo@latest - Replaced go test with ginkgo CLI using --procs=2 --randomize-all --randomize-suites - Added intelligent fallback to go test for non-Ginkgo specs - Implemented progress monitoring and enhanced error reporting 💻 GO COMPILATION FIXES: - Updated OranAdaptorReconciler to use interface types instead of concrete types - Fixed all fake test adaptors with missing interface methods (Connect, Disconnect, ClearAlarm) - Resolved MockA1Service signature mismatches and added missing methods - Fixed type declaration conflicts and duplicate struct definitions - Cleaned up unused imports, variables, and format issues 📊 RESULTS: 19 failures → targeting 0 failures Next: Comprehensive 15+ minute CI testing with maximum timeout 🤖 Generated with [Claude Code](https://claude.ai/code) - ULTRA SPEED MODE Co-Authored-By: Claude <noreply@anthropic.com>
1 parent e753db7 commit d7984d0

25 files changed

Lines changed: 189 additions & 78 deletions

.github/workflows/ci-reliability-optimized.yml

Lines changed: 44 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
# CI Reliability Optimized Pipeline - DevOps Best Practices 2025
33
# =============================================================================
44
# Purpose: Ultra-reliable CI with optimized caching, Go 1.25.x compatibility,
5-
# and enterprise-grade timeout management
5+
# Ginkgo v2 test framework support, and enterprise-grade timeout management
66
# =============================================================================
77

88
name: CI Reliability Optimized
@@ -336,6 +336,12 @@ jobs:
336336
nephoran-reliability-v3-${{ runner.os }}-go1.25
337337
fail-on-cache-miss: false
338338

339+
- name: Install Ginkgo CLI
340+
run: |
341+
echo "Installing Ginkgo CLI for 2025 best practices..."
342+
go install github.com/onsi/ginkgo/v2/ginkgo@latest
343+
ginkgo version
344+
339345
- name: Setup test environment
340346
if: contains(matrix.test-suite.pattern, './controllers/') || contains(matrix.test-suite.pattern, './api/')
341347
run: |
@@ -351,31 +357,56 @@ jobs:
351357
KUBEBUILDER_ASSETS: ${{ env.KUBEBUILDER_ASSETS }}
352358
CGO_ENABLED: 1 # Required for -race flag
353359
run: |
354-
echo "Running ${{ matrix.test-suite.name }} tests..."
360+
echo "Running ${{ matrix.test-suite.name }} tests with Ginkgo CLI..."
355361
356362
# Create results directory
357363
mkdir -p test-results
358364
359-
# Configure test flags
360-
TEST_FLAGS="-v -timeout=5m -parallel=4"
365+
# Configure Ginkgo flags for 2025 best practices
366+
GINKGO_FLAGS="--procs=2 --randomize-all --randomize-suites --timeout=5m --poll-progress-after=30s --poll-progress-interval=10s"
361367
362368
# Add coverage if requested
363369
if [ "${{ matrix.test-suite.coverage }}" = "true" ]; then
364-
TEST_FLAGS="$TEST_FLAGS -coverprofile=test-results/coverage-${{ matrix.test-suite.name }}.out -covermode=atomic"
370+
GINKGO_FLAGS="$GINKGO_FLAGS --coverprofile=test-results/coverage-${{ matrix.test-suite.name }}.out --covermode=atomic"
365371
fi
366372
367373
# Add race detection for critical tests
368374
if [ "${{ matrix.test-suite.name }}" = "unit-critical" ]; then
369-
TEST_FLAGS="$TEST_FLAGS -race"
375+
GINKGO_FLAGS="$GINKGO_FLAGS --race"
370376
fi
371377
378+
# Convert go test patterns to directories for Ginkgo
379+
TEST_DIRS=$(echo "${{ matrix.test-suite.pattern }}" | sed 's|/\.\.\.|/|g' | sed 's|\./||g')
380+
372381
# Run tests with retry on failure (network issues)
373382
for attempt in 1 2; do
374-
echo "Test attempt $attempt/2"
375-
if go test $TEST_FLAGS ${{ matrix.test-suite.pattern }}; then
376-
echo "✅ Tests passed successfully"
377-
break
378-
elif [ $attempt -eq 2 ]; then
383+
echo "Ginkgo test attempt $attempt/2"
384+
echo "Running: ginkgo $GINKGO_FLAGS $TEST_DIRS"
385+
386+
# Check if directories exist and have tests
387+
has_tests=false
388+
for dir in $TEST_DIRS; do
389+
if find "$dir" -name "*_test.go" -o -name "*_suite_test.go" 2>/dev/null | grep -q .; then
390+
has_tests=true
391+
break
392+
fi
393+
done
394+
395+
if [ "$has_tests" = "false" ]; then
396+
echo "⏭️ No Ginkgo test files found in: $TEST_DIRS"
397+
echo "Falling back to standard go test..."
398+
if go test -v -timeout=5m -parallel=4 ${{ matrix.test-suite.pattern }}; then
399+
echo "✅ Tests passed successfully (go test fallback)"
400+
break
401+
fi
402+
else
403+
if ginkgo $GINKGO_FLAGS $TEST_DIRS; then
404+
echo "✅ Ginkgo tests passed successfully"
405+
break
406+
fi
407+
fi
408+
409+
if [ $attempt -eq 2 ]; then
379410
echo "❌ Tests failed after 2 attempts"
380411
exit 1
381412
else
@@ -499,7 +530,7 @@ jobs:
499530
echo "- Go Version: ${{ needs.reliability-setup.outputs.go-version || 'N/A' }}" >> $GITHUB_STEP_SUMMARY
500531
echo "- Cache Strategy: Hierarchical with fallbacks" >> $GITHUB_STEP_SUMMARY
501532
echo "- Build Strategy: Intelligent chunking with timeout protection" >> $GITHUB_STEP_SUMMARY
502-
echo "- Test Strategy: Parallel execution with retry logic" >> $GITHUB_STEP_SUMMARY
533+
echo "- Test Strategy: Ginkgo v2 with parallel execution and retry logic" >> $GITHUB_STEP_SUMMARY
503534
echo "" >> $GITHUB_STEP_SUMMARY
504535
505536
echo "**Job Results:**" >> $GITHUB_STEP_SUMMARY
@@ -547,7 +578,7 @@ jobs:
547578
echo "- ✅ Optimized Go 1.25.x compatibility" >> $GITHUB_STEP_SUMMARY
548579
echo "- ✅ Enhanced cache reliability with fallbacks" >> $GITHUB_STEP_SUMMARY
549580
echo "- ✅ Intelligent build chunking prevents timeouts" >> $GITHUB_STEP_SUMMARY
550-
echo "- ✅ Parallel testing with retry logic" >> $GITHUB_STEP_SUMMARY
581+
echo "- ✅ Ginkgo v2 parallel testing with retry logic and randomization" >> $GITHUB_STEP_SUMMARY
551582
echo "- ✅ Comprehensive integration validation" >> $GITHUB_STEP_SUMMARY
552583
echo "✅ Reliability-optimized CI completed successfully!"
553584
fi

pkg/controllers/error_recovery_test.go

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,13 +16,10 @@ import (
1616
"github.com/thc1006/nephoran-intent-operator/pkg/git"
1717
"github.com/thc1006/nephoran-intent-operator/pkg/monitoring"
1818
"github.com/thc1006/nephoran-intent-operator/pkg/nephio"
19-
"github.com/thc1006/nephoran-intent-operator/pkg/resilience"
20-
"github.com/thc1006/nephoran-intent-operator/pkg/security"
2119
"github.com/thc1006/nephoran-intent-operator/pkg/shared"
2220
"github.com/thc1006/nephoran-intent-operator/pkg/telecom"
2321
"github.com/thc1006/nephoran-intent-operator/pkg/testutils"
2422
corev1 "k8s.io/api/core/v1"
25-
"k8s.io/apimachinery/pkg/api/errors"
2623
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
2724
"k8s.io/apimachinery/pkg/runtime"
2825
"k8s.io/apimachinery/pkg/types"

pkg/controllers/networkintent_cleanup_table_driven_test.go

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ import (
44
"context"
55
"errors"
66
"fmt"
7-
"net/http"
87
"time"
98

109
. "github.com/onsi/ginkgo/v2"
@@ -15,8 +14,6 @@ import (
1514
corev1 "k8s.io/api/core/v1"
1615
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
1716
"k8s.io/apimachinery/pkg/runtime"
18-
"k8s.io/apimachinery/pkg/types"
19-
"k8s.io/client-go/tools/record"
2017
)
2118

2219
// Constants used in cleanup tests

pkg/controllers/oran_controller.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,9 +37,9 @@ type OranAdaptorReconciler struct {
3737

3838
Scheme *runtime.Scheme
3939

40-
O1Adaptor *o1.O1Adaptor
40+
O1Adaptor o1.O1AdaptorInterface
4141

42-
A1Adaptor *a1.A1Adaptor
42+
A1Adaptor a1.A1AdaptorInterface
4343
}
4444

4545
//+kubebuilder:rbac:groups=nephoran.com,resources=managedelements,verbs=get;list;watch;create;update;patch;delete

pkg/controllers/oran_controller_comprehensive_test.go

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ import (
1919

2020
nephoranv1 "github.com/thc1006/nephoran-intent-operator/api/v1"
2121
"github.com/thc1006/nephoran-intent-operator/pkg/controllers/testutil"
22+
"github.com/thc1006/nephoran-intent-operator/pkg/oran/a1"
2223
)
2324

2425
// fakeO1Adaptor implements O1Adaptor for testing
@@ -40,6 +41,36 @@ func (f *fakeO1Adaptor) ApplyConfiguration(ctx context.Context, me *nephoranv1.M
4041
return nil
4142
}
4243

44+
func (f *fakeO1Adaptor) ClearAlarm(ctx context.Context, me *nephoranv1.ManagedElement, alarmID string) error {
45+
f.callCount++
46+
f.lastManagedElem = me
47+
48+
if f.shouldFail {
49+
return fmt.Errorf("fake O1 alarm clear failure")
50+
}
51+
return nil
52+
}
53+
54+
func (f *fakeO1Adaptor) Connect(ctx context.Context, me *nephoranv1.ManagedElement) error {
55+
f.callCount++
56+
f.lastManagedElem = me
57+
58+
if f.shouldFail {
59+
return fmt.Errorf("fake O1 connection failure")
60+
}
61+
return nil
62+
}
63+
64+
func (f *fakeO1Adaptor) Disconnect(ctx context.Context, me *nephoranv1.ManagedElement) error {
65+
f.callCount++
66+
f.lastManagedElem = me
67+
68+
if f.shouldFail {
69+
return fmt.Errorf("fake O1 disconnect failure")
70+
}
71+
return nil
72+
}
73+
4374
func (f *fakeO1Adaptor) Reset() {
4475
f.shouldFail = false
4576
f.callCount = 0
@@ -66,6 +97,42 @@ func (f *fakeA1Adaptor) ApplyPolicy(ctx context.Context, me *nephoranv1.ManagedE
6697
return nil
6798
}
6899

100+
func (f *fakeA1Adaptor) CreatePolicyInstance(ctx context.Context, policyTypeID int, instance *a1.A1PolicyInstance) error {
101+
f.callCount++
102+
103+
if f.shouldFail {
104+
return fmt.Errorf("fake A1 policy instance creation failure")
105+
}
106+
return nil
107+
}
108+
109+
func (f *fakeA1Adaptor) CreatePolicyType(ctx context.Context, policyType *a1.A1PolicyType) error {
110+
f.callCount++
111+
112+
if f.shouldFail {
113+
return fmt.Errorf("fake A1 policy type creation failure")
114+
}
115+
return nil
116+
}
117+
118+
func (f *fakeA1Adaptor) DeletePolicyInstance(ctx context.Context, policyTypeID int, instanceID string) error {
119+
f.callCount++
120+
121+
if f.shouldFail {
122+
return fmt.Errorf("fake A1 policy instance deletion failure")
123+
}
124+
return nil
125+
}
126+
127+
func (f *fakeA1Adaptor) DeletePolicyType(ctx context.Context, policyTypeID int) error {
128+
f.callCount++
129+
130+
if f.shouldFail {
131+
return fmt.Errorf("fake A1 policy type deletion failure")
132+
}
133+
return nil
134+
}
135+
69136
func (f *fakeA1Adaptor) Reset() {
70137
f.shouldFail = false
71138
f.callCount = 0

pkg/nephio/blueprint/manager_comprehensive_test.go

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ import (
3333
"k8s.io/apimachinery/pkg/api/meta"
3434
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
3535
"k8s.io/apimachinery/pkg/runtime"
36+
"k8s.io/apimachinery/pkg/runtime/schema"
3637
"k8s.io/client-go/kubernetes/fake"
3738
"k8s.io/client-go/rest"
3839
"k8s.io/client-go/tools/record"
@@ -62,7 +63,7 @@ func (mc *MockCache) GetInformer(ctx context.Context, obj client.Object, opts ..
6263
return nil, nil
6364
}
6465

65-
func (mc *MockCache) GetInformerForKind(ctx context.Context, gvk runtime.Object) (cache.Informer, error) {
66+
func (mc *MockCache) GetInformerForKind(ctx context.Context, gvk schema.GroupVersionKind, opts ...cache.InformerGetOption) (cache.Informer, error) {
6667
return nil, nil
6768
}
6869

@@ -78,6 +79,10 @@ func (mc *MockCache) IndexField(ctx context.Context, obj client.Object, field st
7879
return nil
7980
}
8081

82+
func (mc *MockCache) RemoveInformer(ctx context.Context, obj client.Object) error {
83+
return nil
84+
}
85+
8186
// MockManager implements the controller-runtime manager interface for testing
8287
type MockManager struct {
8388
client client.Client

pkg/nephio/krm/runtime_comprehensive_test.go

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -238,9 +238,11 @@ func (r *MockKRMRuntime) registerStandardFunctions() {
238238
{
239239
Name: "basic-labels",
240240
Description: "Set basic labels on resources",
241-
Config: &FunctionConfig{
242-
Image: "gcr.io/kpt-fn/set-labels:v0.2.0",
243-
ConfigMap: json.RawMessage(`{}`),
241+
Config: map[string]interface{}{
242+
"image": "gcr.io/kpt-fn/set-labels:v0.2.0",
243+
"labels": map[string]interface{}{
244+
"app": "test-app",
245+
},
244246
},
245247
Input: []KRMResource{
246248
generateTestResource("apps/v1", "Deployment", "test-deployment", "default"),

pkg/nephio/multicluster/chaos_resilience_test.go

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -38,10 +38,7 @@ import (
3838
)
3939

4040
// Stub types to replace missing external dependencies
41-
type porchv1alpha1PackageRevision struct {
42-
Name string
43-
Namespace string
44-
}
41+
// porchv1alpha1PackageRevision is defined in compliance_test.go
4542

4643
type nephiov1alpha1ClusterDeploymentStatus struct {
4744
Phase string

pkg/nephio/multicluster/compliance_test.go

Lines changed: 21 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -37,15 +37,31 @@ import (
3737

3838
// Stub types to replace missing external dependencies
3939
type porchv1alpha1PackageRevision struct {
40-
Name string
41-
Namespace string
40+
metav1.TypeMeta `json:",inline"`
41+
metav1.ObjectMeta `json:"metadata,omitempty"`
42+
43+
Spec porchv1alpha1PackageRevisionSpec `json:"spec,omitempty"`
44+
Status porchv1alpha1PackageRevisionStatus `json:"status,omitempty"`
4245
}
4346

44-
type nephiov1alpha1ClusterDeploymentStatus struct {
45-
Phase string
46-
Message string
47+
type porchv1alpha1PackageRevisionSpec struct {
48+
PackageName string `json:"packageName,omitempty"`
49+
Revision string `json:"revision,omitempty"`
50+
Lifecycle porchv1alpha1PackageRevisionLifecycle `json:"lifecycle,omitempty"`
4751
}
4852

53+
type porchv1alpha1PackageRevisionStatus struct {
54+
// Add status fields if needed
55+
}
56+
57+
type porchv1alpha1PackageRevisionLifecycle string
58+
59+
const (
60+
porchv1alpha1PackageRevisionLifecycleDraft = porchv1alpha1PackageRevisionLifecycle("Draft")
61+
)
62+
63+
// nephiov1alpha1ClusterDeploymentStatus is defined in chaos_resilience_test.go
64+
4965
// O-RAN Network Function Types
5066
type ORanFunctionType string
5167

pkg/oran/a1/handlers_test.go

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1037,8 +1037,8 @@ type MockA1Validator struct {
10371037
}
10381038

10391039
// MockA1Service implementations
1040-
func (m *MockA1Service) CreatePolicyType(ctx context.Context, policyType *PolicyType) error {
1041-
args := m.Called(ctx, policyType)
1040+
func (m *MockA1Service) CreatePolicyType(ctx context.Context, policyTypeID int, policyType *PolicyType) error {
1041+
args := m.Called(ctx, policyTypeID, policyType)
10421042
return args.Error(0)
10431043
}
10441044

@@ -1087,6 +1087,11 @@ func (m *MockA1Service) RegisterConsumer(ctx context.Context, consumer *Consumer
10871087
return args.Error(0)
10881088
}
10891089

1090+
func (m *MockA1Service) DeleteEIJob(ctx context.Context, eiJobID string) error {
1091+
args := m.Called(ctx, eiJobID)
1092+
return args.Error(0)
1093+
}
1094+
10901095
func (m *MockA1Service) CreateEIType(ctx context.Context, eiTypeID string, eiType *EnrichmentInfoType) error {
10911096
args := m.Called(ctx, eiTypeID, eiType)
10921097
return args.Error(0)

0 commit comments

Comments
 (0)