constellation/operators/constellation-node-operator/controllers/scalinggroup_controller_test.go
Thomas Tendyck bd63aa3c6b add license headers
sed -i '1i/*\nCopyright (c) Edgeless Systems GmbH\n\nSPDX-License-Identifier: AGPL-3.0-only\n*/\n' `grep -rL --include='*.go' 'DO NOT EDIT'`
gofumpt -w .
2022-09-05 09:17:25 +02:00

37 lines
780 B
Go

/*
Copyright (c) Edgeless Systems GmbH
SPDX-License-Identifier: AGPL-3.0-only
*/
package controllers
import (
"context"
"sync"
)
type fakeScalingGroupUpdater struct {
sync.RWMutex
scalingGroupImage map[string]string
}
func newFakeScalingGroupUpdater() *fakeScalingGroupUpdater {
return &fakeScalingGroupUpdater{
scalingGroupImage: make(map[string]string),
}
}
func (u *fakeScalingGroupUpdater) GetScalingGroupImage(ctx context.Context, scalingGroupID string) (string, error) {
u.RLock()
defer u.RUnlock()
return u.scalingGroupImage[scalingGroupID], nil
}
func (u *fakeScalingGroupUpdater) SetScalingGroupImage(ctx context.Context, scalingGroupID, imageURI string) error {
u.Lock()
defer u.Unlock()
u.scalingGroupImage[scalingGroupID] = imageURI
return nil
}