Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions test/e2e/Taskfile.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -41,12 +41,21 @@ tasks:
cmds:
- ./scripts/task_run_ci.sh

precheck:prepare:
desc: "Generate JSON report via ginkgo dry-run for precheck preparation"
cmds:
- |
# Run ginkgo dry-run with same filters as run task to collect only filtered specs
# Prechecks are executed in e2e_test.go SynchronizedBeforeSuite based on labels from this report
./scripts/precheck-prepare.sh

run:
desc: "Run e2e tests"
deps:
- copy
- kubectl
- d8
- precheck:prepare
cmds:
- |
go tool ginkgo -v \
Expand Down
8 changes: 5 additions & 3 deletions test/e2e/blockdevice/data_exports.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ import (
"github.com/deckhouse/virtualization/test/e2e/internal/framework"
"github.com/deckhouse/virtualization/test/e2e/internal/label"
"github.com/deckhouse/virtualization/test/e2e/internal/object"
"github.com/deckhouse/virtualization/test/e2e/internal/precheck"
"github.com/deckhouse/virtualization/test/e2e/internal/util"
)

Expand All @@ -57,10 +58,11 @@ const (
diskImageExportFile = "disk.img"
)

var _ = Describe("DataExports", label.Slow(), func() {
f := framework.NewFramework("data-exports")
var _ = Describe("DataExports", label.Slow(), Label(precheck.PrecheckSVDM, precheck.PrecheckSnapshot), func() {
var f *framework.Framework

BeforeEach(func() {
f = framework.NewFramework("data-exports")
moduleEnabled, err := checkStorageVolumeDataManagerEnabled()
Expect(err).NotTo(HaveOccurred(), "Failed to get modules")
if !moduleEnabled {
Expand Down Expand Up @@ -365,7 +367,7 @@ func handleUploadResponse(resp *http.Response) error {
}

func checkStorageVolumeDataManagerEnabled() (bool, error) {
sdnModule, err := framework.NewFramework("").GetModuleConfig("storage-volume-data-manager")
sdnModule, err := framework.NewFramework("").GetModuleConfig(context.Background(), "storage-volume-data-manager")
if err != nil {
return false, err
}
Expand Down
7 changes: 5 additions & 2 deletions test/e2e/blockdevice/importer_network_policy.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,14 +26,17 @@ import (
"github.com/deckhouse/virtualization/api/core/v1alpha2"
"github.com/deckhouse/virtualization/test/e2e/internal/framework"
"github.com/deckhouse/virtualization/test/e2e/internal/object"
"github.com/deckhouse/virtualization/test/e2e/internal/precheck"
"github.com/deckhouse/virtualization/test/e2e/internal/util"
)

var _ = Describe("ImporterNetworkPolicy", func() {
var _ = Describe("ImporterNetworkPolicy", Label(precheck.NoPrecheck), func() {
const testName = "importer-network-policy"
f := framework.NewFramework("")

var f *framework.Framework

BeforeEach(func() {
f = framework.NewFramework("")
f.Before()
DeferCleanup(f.After)
})
Expand Down
6 changes: 4 additions & 2 deletions test/e2e/blockdevice/virtual_disk_provisioning.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,13 +29,15 @@ import (
"github.com/deckhouse/virtualization/api/core/v1alpha2"
"github.com/deckhouse/virtualization/test/e2e/internal/framework"
"github.com/deckhouse/virtualization/test/e2e/internal/object"
"github.com/deckhouse/virtualization/test/e2e/internal/precheck"
"github.com/deckhouse/virtualization/test/e2e/internal/util"
)

var _ = Describe("VirtualDiskProvisioning", func() {
f := framework.NewFramework("vd-provisioning")
var _ = Describe("VirtualDiskProvisioning", Label(precheck.NoPrecheck), func() {
var f *framework.Framework

BeforeEach(func() {
f = framework.NewFramework("vd-provisioning")
sc := framework.GetConfig().StorageClass.TemplateStorageClass
if sc != nil && sc.Provisioner == framework.NFS {
Skip("VirtualImages on PVC only work with block storage classes, skipping NFS")
Expand Down
6 changes: 4 additions & 2 deletions test/e2e/blockdevice/virtual_image_creation.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,13 +34,15 @@ import (
"github.com/deckhouse/virtualization/api/core/v1alpha2"
"github.com/deckhouse/virtualization/test/e2e/internal/framework"
"github.com/deckhouse/virtualization/test/e2e/internal/object"
"github.com/deckhouse/virtualization/test/e2e/internal/precheck"
"github.com/deckhouse/virtualization/test/e2e/internal/util"
)

var _ = Describe("VirtualImageCreation", func() {
f := framework.NewFramework("vi-creation")
var _ = Describe("VirtualImageCreation", Label(precheck.PrecheckSnapshot), func() {
var f *framework.Framework

BeforeEach(func() {
f = framework.NewFramework("vi-creation")
sc := framework.GetConfig().StorageClass.TemplateStorageClass
if sc != nil && sc.Provisioner == framework.NFS {
Skip("VirtualImages on PVC only work with block storage classes, skipping NFS")
Expand Down
16 changes: 16 additions & 0 deletions test/e2e/e2e_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ import (

_ "github.com/deckhouse/virtualization/test/e2e/blockdevice"
"github.com/deckhouse/virtualization/test/e2e/controller"
"github.com/deckhouse/virtualization/test/e2e/internal/framework"
"github.com/deckhouse/virtualization/test/e2e/internal/precheck"
"github.com/deckhouse/virtualization/test/e2e/legacy"
_ "github.com/deckhouse/virtualization/test/e2e/snapshot"
_ "github.com/deckhouse/virtualization/test/e2e/vm"
Expand All @@ -39,8 +41,22 @@ func TestE2E(t *testing.T) {
}

var _ = SynchronizedBeforeSuite(func() {
// Initialize test resources BEFORE running prechecks
// This ensures resources are available even if prechecks fail
controller.NewBeforeProcess1Body()
legacy.NewBeforeProcess1Body()

// Validate precheck labels from JSON report (created by dry-run during prepare)
if err := precheck.ValidateFromJSONFile(precheck.LabelsFile); err != nil {
Fail("precheck validation failed: " + err.Error())
}

// Load spec labels to determine which prechecks to run
precheck.LoadSpecLabelsFromFile(precheck.LabelsFile, GinkgoLabelFilter())
// Run prechecks based on loaded labels
// Must run after resource initialization to avoid panic in SynchronizedAfterSuite
precheck.Run(framework.NewFramework(""), GinkgoLabelFilter())

bootstrapPrecreatedCVIs()
}, func() {})

Expand Down
65 changes: 65 additions & 0 deletions test/e2e/internal/api/deckhouse/v1alpha1/deep_copy.go
Original file line number Diff line number Diff line change
Expand Up @@ -123,3 +123,68 @@ func (v SettingsValues) DeepCopyInto(out *SettingsValues) {
return
}
}

// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *Module) DeepCopyInto(out *Module) {
*out = *in
out.TypeMeta = in.TypeMeta
in.ObjectMeta.DeepCopyInto(&out.ObjectMeta)
in.Status.DeepCopyInto(&out.Status)
}

// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Module.
func (in *Module) DeepCopy() *Module {
if in == nil {
return nil
}
out := new(Module)
in.DeepCopyInto(out)
return out
}

// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
func (in *Module) DeepCopyObject() runtime.Object {
if c := in.DeepCopy(); c != nil {
return c
}
return nil
}

// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *ModuleCondition) DeepCopyInto(out *ModuleCondition) {
*out = *in
in.LastProbeTime.DeepCopyInto(&out.LastProbeTime)
in.LastTransitionTime.DeepCopyInto(&out.LastTransitionTime)
}

// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ModuleCondition.
func (in *ModuleCondition) DeepCopy() *ModuleCondition {
if in == nil {
return nil
}
out := new(ModuleCondition)
in.DeepCopyInto(out)
return out
}

// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *ModuleStatus) DeepCopyInto(out *ModuleStatus) {
*out = *in
if in.Conditions != nil {
in, out := &in.Conditions, &out.Conditions
*out = make([]ModuleCondition, len(*in))
for i := range *in {
(*in)[i].DeepCopyInto(&(*out)[i])
}
}
}

// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ModuleStatus.
func (in *ModuleStatus) DeepCopy() *ModuleStatus {
if in == nil {
return nil
}
out := new(ModuleStatus)
in.DeepCopyInto(out)
return out
}
61 changes: 61 additions & 0 deletions test/e2e/internal/api/deckhouse/v1alpha1/module.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
/*
Copyright 2026 Flant JSC

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/

package v1alpha1

import (
corev1 "k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
)

// +k8s:deepcopy-gen=true
// +kubebuilder:object:root=true
// +kubebuilder:subresource:status
type Module struct {
metav1.TypeMeta `json:",inline"`
metav1.ObjectMeta `json:"metadata,omitempty"`
Status ModuleStatus `json:"status"`
}

// +k8s:deepcopy-gen=true
type ModuleStatus struct {
Phase string `json:"phase,omitempty"`
HooksState string `json:"hooksState,omitempty"`
Conditions []ModuleCondition `json:"conditions,omitempty" patchStrategy:"merge" patchMergeKey:"type"`
}

// +k8s:deepcopy-gen=true
type ModuleCondition struct {
// Type is the type of the condition.
// More info: https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#pod-conditions
Type string `json:"type,omitempty"`
// Machine-readable, UpperCamelCase text indicating the reason for the condition's last transition.
// More info: https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#pod-conditions
Reason string `json:"reason,omitempty"`
// Human-readable message indicating details about last transition.
// More info: https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#pod-conditions
Message string `json:"message,omitempty"`
// Status is the status of the condition.
// Can be True, False, Unknown.
// More info: https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#pod-conditions
Status corev1.ConditionStatus `json:"status,omitempty"`
// Timestamp of when the condition was last probed.
// More info: https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#pod-conditions
LastProbeTime metav1.Time `json:"lastProbeTime"`
// Last time the condition transitioned from one status to another.
// More info: https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#pod-conditions
LastTransitionTime metav1.Time `json:"lastTransitionTime"`
}
1 change: 1 addition & 0 deletions test/e2e/internal/api/deckhouse/v1alpha1/register.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ func addKnownTypes(scheme *runtime.Scheme) error {
scheme.AddKnownTypes(SchemeGroupVersion,
&ModuleConfig{},
&ModuleConfigList{},
&Module{},
)

metav1.AddToGroupVersion(scheme, SchemeGroupVersion)
Expand Down
Loading
Loading