refactor: rename package from gitops_rac to benadis_rac
The package and related files have been renamed to better reflect the project's naming conventions. This change includes: - Renaming the main package file - Updating all references in integration tests - Maintaining all existing functionality without behavior changes
This commit is contained in:
@@ -1,5 +1,5 @@
|
|||||||
// Package gitops_rac provides functionality for managing 1C service mode
|
// Package benadis_rac provides functionality for managing 1C service mode
|
||||||
package gitops_rac
|
package benadis_rac
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
//go:build integration
|
//go:build integration
|
||||||
// +build integration
|
// +build integration
|
||||||
|
|
||||||
package gitops_rac
|
package git.benadis.ru/gitops/benadis-rac
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
@@ -21,17 +21,17 @@ func TestIntegrationServiceMode(t *testing.T) {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatalf("Failed to create client: %v", err)
|
t.Fatalf("Failed to create client: %v", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
ctx, cancel := context.WithTimeout(context.Background(), 2*time.Minute)
|
ctx, cancel := context.WithTimeout(context.Background(), 2*time.Minute)
|
||||||
defer cancel()
|
defer cancel()
|
||||||
|
|
||||||
// Получаем текущий статус
|
// Получаем текущий статус
|
||||||
initialStatus, err := client.GetServiceModeStatus(ctx)
|
initialStatus, err := client.GetServiceModeStatus(ctx)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatalf("Failed to get initial service mode status: %v", err)
|
t.Fatalf("Failed to get initial service mode status: %v", err)
|
||||||
}
|
}
|
||||||
t.Logf("Initial service mode status: %v", initialStatus)
|
t.Logf("Initial service mode status: %v", initialStatus)
|
||||||
|
|
||||||
// Тестируем включение сервисного режима
|
// Тестируем включение сервисного режима
|
||||||
t.Run("Enable Service Mode", func(t *testing.T) {
|
t.Run("Enable Service Mode", func(t *testing.T) {
|
||||||
err := client.EnableServiceMode(ctx)
|
err := client.EnableServiceMode(ctx)
|
||||||
@@ -39,23 +39,23 @@ func TestIntegrationServiceMode(t *testing.T) {
|
|||||||
t.Errorf("Failed to enable service mode: %v", err)
|
t.Errorf("Failed to enable service mode: %v", err)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
// Проверяем что режим действительно включен
|
// Проверяем что режим действительно включен
|
||||||
status, err := client.GetServiceModeStatus(ctx)
|
status, err := client.GetServiceModeStatus(ctx)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Errorf("Failed to get service mode status after enabling: %v", err)
|
t.Errorf("Failed to get service mode status after enabling: %v", err)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
if !status {
|
if !status {
|
||||||
t.Error("Service mode should be enabled but it's not")
|
t.Error("Service mode should be enabled but it's not")
|
||||||
}
|
}
|
||||||
t.Log("Service mode enabled successfully")
|
t.Log("Service mode enabled successfully")
|
||||||
})
|
})
|
||||||
|
|
||||||
// Небольшая пауза между операциями
|
// Небольшая пауза между операциями
|
||||||
time.Sleep(2 * time.Second)
|
time.Sleep(2 * time.Second)
|
||||||
|
|
||||||
// Тестируем выключение сервисного режима
|
// Тестируем выключение сервисного режима
|
||||||
t.Run("Disable Service Mode", func(t *testing.T) {
|
t.Run("Disable Service Mode", func(t *testing.T) {
|
||||||
err := client.DisableServiceMode(ctx)
|
err := client.DisableServiceMode(ctx)
|
||||||
@@ -63,20 +63,20 @@ func TestIntegrationServiceMode(t *testing.T) {
|
|||||||
t.Errorf("Failed to disable service mode: %v", err)
|
t.Errorf("Failed to disable service mode: %v", err)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
// Проверяем что режим действительно выключен
|
// Проверяем что режим действительно выключен
|
||||||
status, err := client.GetServiceModeStatus(ctx)
|
status, err := client.GetServiceModeStatus(ctx)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Errorf("Failed to get service mode status after disabling: %v", err)
|
t.Errorf("Failed to get service mode status after disabling: %v", err)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
if status {
|
if status {
|
||||||
t.Error("Service mode should be disabled but it's not")
|
t.Error("Service mode should be disabled but it's not")
|
||||||
}
|
}
|
||||||
t.Log("Service mode disabled successfully")
|
t.Log("Service mode disabled successfully")
|
||||||
})
|
})
|
||||||
|
|
||||||
// Восстанавливаем исходное состояние
|
// Восстанавливаем исходное состояние
|
||||||
if initialStatus {
|
if initialStatus {
|
||||||
t.Log("Restoring initial service mode state (enabled)")
|
t.Log("Restoring initial service mode state (enabled)")
|
||||||
@@ -98,15 +98,15 @@ func TestIntegrationStatusOnly(t *testing.T) {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatalf("Failed to create client: %v", err)
|
t.Fatalf("Failed to create client: %v", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
ctx, cancel := context.WithTimeout(context.Background(), 30*time.Second)
|
ctx, cancel := context.WithTimeout(context.Background(), 30*time.Second)
|
||||||
defer cancel()
|
defer cancel()
|
||||||
|
|
||||||
status, err := client.GetServiceModeStatus(ctx)
|
status, err := client.GetServiceModeStatus(ctx)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatalf("Failed to get service mode status: %v", err)
|
t.Fatalf("Failed to get service mode status: %v", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
t.Logf("Current service mode status: %v", status)
|
t.Logf("Current service mode status: %v", status)
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -137,7 +137,7 @@ func TestIntegrationConfigValidation(t *testing.T) {
|
|||||||
expectErr: true,
|
expectErr: true,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
for _, tt := range tests {
|
for _, tt := range tests {
|
||||||
t.Run(tt.name, func(t *testing.T) {
|
t.Run(tt.name, func(t *testing.T) {
|
||||||
_, err := NewClient(Config{
|
_, err := NewClient(Config{
|
||||||
@@ -145,7 +145,7 @@ func TestIntegrationConfigValidation(t *testing.T) {
|
|||||||
SecretPath: tt.secretPath,
|
SecretPath: tt.secretPath,
|
||||||
LogLevel: "Error", // Минимальный уровень логирования для тестов
|
LogLevel: "Error", // Минимальный уровень логирования для тестов
|
||||||
})
|
})
|
||||||
|
|
||||||
if tt.expectErr && err == nil {
|
if tt.expectErr && err == nil {
|
||||||
t.Error("Expected error but got none")
|
t.Error("Expected error but got none")
|
||||||
}
|
}
|
||||||
@@ -166,9 +166,9 @@ func BenchmarkServiceModeOperations(b *testing.B) {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
b.Fatalf("Failed to create client: %v", err)
|
b.Fatalf("Failed to create client: %v", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
ctx := context.Background()
|
ctx := context.Background()
|
||||||
|
|
||||||
b.Run("GetStatus", func(b *testing.B) {
|
b.Run("GetStatus", func(b *testing.B) {
|
||||||
for i := 0; i < b.N; i++ {
|
for i := 0; i < b.N; i++ {
|
||||||
_, err := client.GetServiceModeStatus(ctx)
|
_, err := client.GetServiceModeStatus(ctx)
|
||||||
@@ -177,4 +177,4 @@ func BenchmarkServiceModeOperations(b *testing.B) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user