mirror of
https://github.com/kubevela/kubevela.git
synced 2026-08-18 03:56:36 +00:00
+6








b5a9925042
* Create testwr Signed-off-by: Vaibhav Agrawal <vaibhav.agrawal0096@gmail.com> Co-authored-by: Ayush Kumar <ayushshyamkumar888@gmail.com> * Update testwr Signed-off-by: Vaibhav Agrawal <vaibhav.agrawal0096@gmail.com> Co-authored-by: Vaibhav Agrawal <vaibhav.agrawal0096@gmail.com> * Update testwr Signed-off-by: Vaibhav Agrawal <vaibhav.agrawal0096@gmail.com> Co-authored-by: Ayush Kumar <ayushshyamkumar888@gmail.com> * Update testwr Signed-off-by: Vaibhav Agrawal <vaibhav.agrawal0096@gmail.com> Co-authored-by: Vaibhav Agrawal <vaibhav.agrawal0096@gmail.com> * Update testwr Signed-off-by: Vaibhav Agrawal <vaibhav.agrawal0096@gmail.com> Co-authored-by: Ayush Kumar <ayushshyamkumar888@gmail.com> * Update testwr Signed-off-by: Vaibhav Agrawal <vaibhav.agrawal0096@gmail.com> Co-authored-by: Vaibhav Agrawal <vaibhav.agrawal0096@gmail.com> * Update testwr Signed-off-by: Vaibhav Agrawal <vaibhav.agrawal0096@gmail.com> Co-authored-by: Ayush Kumar <ayushshyamkumar888@gmail.com> * Update testwr Signed-off-by: Vaibhav Agrawal <vaibhav.agrawal0096@gmail.com> Co-authored-by: Vaibhav Agrawal <vaibhav.agrawal0096@gmail.com> * Delete testwr Signed-off-by: Vaibhav Agrawal <vaibhav.agrawal0096@gmail.com> Co-authored-by: Ayush Kumar <ayushshyamkumar888@gmail.com> * Chore: (deps): Bump goreleaser/goreleaser-action from 5.0.0 to 6.3.0 (#6775) Bumps [goreleaser/goreleaser-action](https://github.com/goreleaser/goreleaser-action) from 5.0.0 to 6.3.0. - [Release notes](https://github.com/goreleaser/goreleaser-action/releases) - [Commits](https://github.com/goreleaser/goreleaser-action/compare/7ec5c2b0c6cdda6e8bbb49444bc797dd33d74dd8...9c156ee8a17a598857849441385a2041ef570552) --- updated-dependencies: - dependency-name: goreleaser/goreleaser-action dependency-version: 6.3.0 dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Signed-off-by: Vaibhav Agrawal <vaibhav.agrawal0096@gmail.com> * Chore: Replace the openssf badge with UI link (#6783) [optional body] [optional footer] Signed-off-by: Anoop Gopalakrishnan <anoop2811@aol.in> Signed-off-by: Vaibhav Agrawal <vaibhav.agrawal0096@gmail.com> Co-authored-by: Ayush Kumar <ayushshyamkumar888@gmail.com> * chore: moves dockerhub user name to secret section in the reusable workflow (#6778) Signed-off-by: Ayush Kumar <ayushshyamkumar888@gmail.com> Signed-off-by: Ayush <ayushshyam.official.888@gmail.com> Signed-off-by: Vaibhav Agrawal <vaibhav.agrawal0096@gmail.com> Co-authored-by: Vaibhav Agrawal <vaibhav.agrawal0096@gmail.com> * Chore: update helm repo path in tests (#6797) * chore: fixes the breaking tests with older helm chart address Signed-off-by: Ayush Kumar <ayushshyamkumar888@gmail.com> Co-authored-by: Amit Singh <singhamitch@outlook.com> Co-authored-by: Vaibhav Agrawal <vaibhav.agrawal0096@gmail.com> Signed-off-by: semmet95 <singhamitch@outlook.com> * tests: update the registery url Signed-off-by: semmet95 <singhamitch@outlook.com> * updates the default url Signed-off-by: semmet95 <singhamitch@outlook.com> * test: reverts the changes Signed-off-by: semmet95 <singhamitch@outlook.com> * fix: sets github repo directory as the default definition registry Signed-off-by: Amit Singh <singhamitch@outlook.com> Signed-off-by: semmet95 <singhamitch@outlook.com> * chore: reverts the default definition registry url Signed-off-by: Amit Singh <singhamitch@outlook.com> * test: overwrites custom definition registry url Signed-off-by: Amit Singh <singhamitch@outlook.com> * debugging test failure Signed-off-by: Amit Singh <singhamitch@outlook.com> --------- Signed-off-by: Ayush Kumar <ayushshyamkumar888@gmail.com> Signed-off-by: semmet95 <singhamitch@outlook.com> Signed-off-by: Amit Singh <singhamitch@outlook.com> Co-authored-by: Amit Singh <singhamitch@outlook.com> Co-authored-by: Vaibhav Agrawal <vaibhav.agrawal0096@gmail.com> Signed-off-by: Vaibhav Agrawal <vaibhav.agrawal0096@gmail.com> * Fix: moves resource modification inside patch block (#6791) * fix: moves resource modification inside patch block Signed-off-by: Ayush Shyam Kumar <ayushshyam.official.888@gmail.com> Signed-off-by: semmet95 <singhamitch@outlook.com> * chore: adds changes from make-reviewable Signed-off-by: Ayush Shyam Kumar <ayushshyam.official.888@gmail.com> Signed-off-by: semmet95 <singhamitch@outlook.com> * debugging error Signed-off-by: Ayush Shyam Kumar <ayushshyam.official.888@gmail.com> Signed-off-by: semmet95 <singhamitch@outlook.com> * test: updates the helm outdated path to new one Signed-off-by: Amit Singh <singhamitch@outlook.com> Signed-off-by: semmet95 <singhamitch@outlook.com> * tests: fixes the failing helm test case Signed-off-by: semmet95 <singhamitch@outlook.com> * removes debugging printing statements Signed-off-by: Amit Singh <singhamitch@outlook.com> Signed-off-by: semmet95 <singhamitch@outlook.com> --------- Signed-off-by: Ayush Shyam Kumar <ayushshyam.official.888@gmail.com> Signed-off-by: semmet95 <singhamitch@outlook.com> Signed-off-by: Amit Singh <singhamitch@outlook.com> Co-authored-by: Ayush <ayushshyam.official.888@gmail.com> Signed-off-by: Vaibhav Agrawal <vaibhav.agrawal0096@gmail.com> * Chore: switches to new oapi type field type (#6794) * chore: switches to new oapi type field type Signed-off-by: Amit Singh <singhamitch@outlook.com> Signed-off-by: semmet95 <singhamitch@outlook.com> * chore: updates gen_sdk to use the new schema type Signed-off-by: Amit Singh <singhamitch@outlook.com> Signed-off-by: semmet95 <singhamitch@outlook.com> * chore: updates gen_sdk_test to use the new schema type Signed-off-by: Amit Singh <singhamitch@outlook.com> Signed-off-by: semmet95 <singhamitch@outlook.com> * chore: updates schema to use the new schema type Signed-off-by: Amit Singh <singhamitch@outlook.com> Signed-off-by: semmet95 <singhamitch@outlook.com> * fix: updates chart urls Signed-off-by: Amit Singh <singhamitch@outlook.com> Signed-off-by: semmet95 <singhamitch@outlook.com> * chore: changes from make reviewable Signed-off-by: Amit Singh <singhamitch@outlook.com> Signed-off-by: semmet95 <singhamitch@outlook.com> * chore: fixes linting errors Signed-off-by: Amit Singh <singhamitch@outlook.com> Signed-off-by: semmet95 <singhamitch@outlook.com> * debugging test failure Signed-off-by: Amit Singh <singhamitch@outlook.com> Signed-off-by: semmet95 <singhamitch@outlook.com> * fix: fixes schema type nil check Signed-off-by: Amit Singh <singhamitch@outlook.com> Signed-off-by: semmet95 <singhamitch@outlook.com> * chore: replaces literals with constants Signed-off-by: Amit Singh <singhamitch@outlook.com> Signed-off-by: semmet95 <singhamitch@outlook.com> * debugging test failure Signed-off-by: Amit Singh <singhamitch@outlook.com> Signed-off-by: semmet95 <singhamitch@outlook.com> * test: switches to the new addon registry url Signed-off-by: Amit Singh <singhamitch@outlook.com> Signed-off-by: semmet95 <singhamitch@outlook.com> * chore: extra line removal Signed-off-by: Amit Singh <singhamitch@outlook.com> Signed-off-by: semmet95 <singhamitch@outlook.com> * fix: replaces deprecated urls Signed-off-by: Amit Singh <singhamitch@outlook.com> Signed-off-by: semmet95 <singhamitch@outlook.com> * fix: removes extra quotes form marshaljson Signed-off-by: Amit Singh <singhamitch@outlook.com> Signed-off-by: semmet95 <singhamitch@outlook.com> * fix: updates chart url in mock resource Signed-off-by: Amit Singh <singhamitch@outlook.com> Signed-off-by: semmet95 <singhamitch@outlook.com> --------- Signed-off-by: Amit Singh <singhamitch@outlook.com> Signed-off-by: semmet95 <singhamitch@outlook.com> Co-authored-by: Vishal Kumar <vishal210893@gmail.com> Signed-off-by: Vaibhav Agrawal <vaibhav.agrawal0096@gmail.com> * Fix: vela cli namespace behaviour (#6805) Signed-off-by: Vaibhav Agrawal <vaibhav.agrawal0096@gmail.com> Co-authored-by: Vaibhav Agrawal <vaibhav.agrawal0096@gmail.com> * Fix: vela up command to behave similarly with kubectl (#6809) * Fix: vela up command to behave similarly with kubectl Signed-off-by: Chaitanya Reddy Onteddu <chaitanyareddy0702@gmail.com> * Chore: Update the unit test cases and add a new test cases Signed-off-by: Chaitanya Reddy Onteddu <chaitanyareddy0702@gmail.com> --------- Signed-off-by: Chaitanya Reddy Onteddu <chaitanyareddy0702@gmail.com> Co-authored-by: Chaitanya Reddy Onteddu <co@guidewire.com> Signed-off-by: Vaibhav Agrawal <vaibhav.agrawal0096@gmail.com> * Fix: check component status after initial deployment (#6824) * fix: check component status after initial deployment Signed-off-by: Brian Kane <briankane1@gmail.com> * Fix: applications should correctly reflect component health throughout the apps lifecycle Signed-off-by: Brian Kane <briankane1@gmail.com> * Fix: check component status after initial deployment Signed-off-by: Brian Kane <briankane1@gmail.com> --------- Signed-off-by: Brian Kane <briankane1@gmail.com> Co-authored-by: Mikhail Elenskii <elenskii-mikhail@outlook.com> Signed-off-by: Vaibhav Agrawal <vaibhav.agrawal0096@gmail.com> * chore: upgrade k8s version to v0.31.10 and corresponding fixes Signed-off-by: vishal210893 <vishal210893@gmail.com> Signed-off-by: Vaibhav Agrawal <vaibhav.agrawal0096@gmail.com> Co-authored-by: Ayush Kumar <ayushshyamkumar888@gmail.com> * fix: remove defer from feature gate testing in multiple test files Signed-off-by: vishal210893 <vishal210893@gmail.com> Signed-off-by: Vaibhav Agrawal <vaibhav.agrawal0096@gmail.com> Co-authored-by: Vaibhav Agrawal <vaibhav.agrawal0096@gmail.com> * fix: remove defer from feature gate testing in multiple test files Signed-off-by: vishal210893 <vishal210893@gmail.com> Signed-off-by: Vaibhav Agrawal <vaibhav.agrawal0096@gmail.com> Co-authored-by: Ayush Kumar <ayushshyamkumar888@gmail.com> * fix: use RunPortForwardContext for improved context handling in port forwarding Signed-off-by: vishal210893 <vishal210893@gmail.com> Signed-off-by: Vaibhav Agrawal <vaibhav.agrawal0096@gmail.com> Co-authored-by: Vaibhav Agrawal <vaibhav.agrawal0096@gmail.com> * Chore: Fix check-diff Signed-off-by: Chaitanya Reddy Onteddu <co@guidewire.com> Signed-off-by: Vaibhav Agrawal <vaibhav.agrawal0096@gmail.com> Co-authored-by: Ayush Kumar <ayushshyamkumar888@gmail.com> * Chore: Update ENVTEST_K8S_VERSION variable Signed-off-by: Vaibhav Agrawal <vaibhav.agrawal0096@gmail.com> Co-authored-by: Vaibhav Agrawal <vaibhav.agrawal0096@gmail.com> * fix: update feature gate testing to use GinkgoT for improved context handling Co-authored-by: Vaibhav Agrawal <vaibhav.agrawal0096@gmail.com> Signed-off-by: Vaibhav Agrawal <vaibhav.agrawal0096@gmail.com> * Fix: update Kubernetes version in e2e tests to v1.31 Signed-off-by: Ayush Kumar <ayushshyamkumar888@gmail.com> Co-authored-by: Vaibhav Agrawal <vaibhav.agrawal0096@gmail.com> Signed-off-by: Vaibhav Agrawal <vaibhav.agrawal0096@gmail.com> Co-authored-by: Vaibhav Agrawal <vaibhav.agrawal0096@gmail.com> * Fix: increase timeout for application revision retrieval in multicluster tests Signed-off-by: Vaibhav Agrawal <vaibhav.agrawal0096@gmail.com> Co-authored-by: Ayush Kumar <ayushshyamkumar888@gmail.com> * chore: update kubevela workflow to master Signed-off-by: Vaibhav Agrawal <vaibhav.agrawal0096@gmail.com> * Fix: increase timeout in multicluster tests Signed-off-by: Vishal Kumar <vishal210893@gmail.com> * fix: upgrade dependencies and improve context handling in port forwarding Signed-off-by: vishal210893 <vishal210893@gmail.com> * chore: remove space to trigger pipeline Signed-off-by: vishal210893 <vishal210893@gmail.com> * chore: add space to trigger pipeline Signed-off-by: vishal210893 <vishal210893@gmail.com> * chore: updated go sum Signed-off-by: vishal210893 <vishal210893@gmail.com> * chore: updated go.mod for running github action Signed-off-by: vishal210893 <vishal210893@gmail.com> * chore: updated go.mod for running github action Signed-off-by: vishal210893 <vishal210893@gmail.com> * Fix: increase timeout and enhanced multicluster tests Signed-off-by: Vaibhav Agrawal <vaibhav.agrawal0096@gmail.com> * adding a comment to re run the pipeline Signed-off-by: Vaibhav Agrawal <vaibhav.agrawal0096@gmail.com> * Adding back decription removed during check-diff Signed-off-by: Vaibhav Agrawal <vaibhav.agrawal0096@gmail.com> * ran make reviewable Signed-off-by: Vaibhav Agrawal <vaibhav.agrawal0096@gmail.com> * replaced generate-groups.sh with kube_codegen.sh Signed-off-by: Vaibhav Agrawal <vaibhav.agrawal0096@gmail.com> * API Call changes for kube_codegen Signed-off-by: Vaibhav Agrawal <vaibhav.agrawal0096@gmail.com> * fixed incorrect Api package path format and output dir handling Signed-off-by: Vaibhav Agrawal <vaibhav.agrawal0096@gmail.com> * resolved incompatible dependencies issue Signed-off-by: Vaibhav Agrawal <vaibhav.agrawal0096@gmail.com> * chore: update clientgen.sh to use kubevela clientgen_work_temp Signed-off-by: Reetika Malhotra <malhotra.reetika25@gmail.com> * chore: update clientgen.sh to use kubevela clientgen_work_temp Signed-off-by: Reetika Malhotra <malhotra.reetika25@gmail.com> * test: increase timeout for application deployment and rollback verification Signed-off-by: Vaibhav Agrawal <vaibhav.agrawal0096@gmail.com> --------- Signed-off-by: Vaibhav Agrawal <vaibhav.agrawal0096@gmail.com> Signed-off-by: dependabot[bot] <support@github.com> Signed-off-by: Anoop Gopalakrishnan <anoop2811@aol.in> Signed-off-by: Ayush Kumar <ayushshyamkumar888@gmail.com> Signed-off-by: Ayush <ayushshyam.official.888@gmail.com> Signed-off-by: semmet95 <singhamitch@outlook.com> Signed-off-by: Amit Singh <singhamitch@outlook.com> Signed-off-by: Ayush Shyam Kumar <ayushshyam.official.888@gmail.com> Signed-off-by: Chaitanya Reddy Onteddu <chaitanyareddy0702@gmail.com> Signed-off-by: Brian Kane <briankane1@gmail.com> Signed-off-by: vishal210893 <vishal210893@gmail.com> Signed-off-by: Chaitanya Reddy Onteddu <co@guidewire.com> Signed-off-by: Vishal Kumar <vishal210893@gmail.com> Signed-off-by: Reetika Malhotra <malhotra.reetika25@gmail.com> Co-authored-by: Ayush Kumar <ayushshyamkumar888@gmail.com> Co-authored-by: Vaibhav Agrawal <vaibhav.agrawal0096@gmail.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Anoop Gopalakrishnan <2038273+anoop2811@users.noreply.github.com> Co-authored-by: Ayush Kumar <65535504+roguepikachu@users.noreply.github.com> Co-authored-by: Amit Singh <singhamitch@outlook.com> Co-authored-by: Ayush <ayushshyam.official.888@gmail.com> Co-authored-by: Chaitanyareddy0702 <78363486+Chaitanyareddy0702@users.noreply.github.com> Co-authored-by: Chaitanya Reddy Onteddu <co@guidewire.com> Co-authored-by: Brian Kane <briankane1@gmail.com> Co-authored-by: Mikhail Elenskii <elenskii-mikhail@outlook.com> Co-authored-by: Chaitanya Reddy Onteddu <chaitanyareddy0702@gmail.com> Co-authored-by: Reetika Malhotra <malhotra.reetika25@gmail.com>
85 lines
2.4 KiB
Go
85 lines
2.4 KiB
Go
/*
|
|
Copyright 2022 The KubeVela Authors.
|
|
|
|
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 auth
|
|
|
|
import (
|
|
"testing"
|
|
|
|
"github.com/stretchr/testify/require"
|
|
authv1 "k8s.io/api/authentication/v1"
|
|
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
|
"k8s.io/apiserver/pkg/authentication/user"
|
|
utilfeature "k8s.io/apiserver/pkg/util/feature"
|
|
featuregatetesting "k8s.io/component-base/featuregate/testing"
|
|
|
|
"github.com/oam-dev/kubevela/apis/core.oam.dev/v1beta1"
|
|
"github.com/oam-dev/kubevela/pkg/features"
|
|
"github.com/oam-dev/kubevela/pkg/oam"
|
|
)
|
|
|
|
func TestContextWithUserInfo(t *testing.T) {
|
|
featuregatetesting.SetFeatureGateDuringTest(t, utilfeature.DefaultFeatureGate, features.AuthenticateApplication, true)
|
|
AuthenticationWithUser = true
|
|
defer func() {
|
|
AuthenticationWithUser = false
|
|
}()
|
|
testCases := map[string]struct {
|
|
UserInfo *authv1.UserInfo
|
|
ServiceAccount string
|
|
ExpectUserInfo user.Info
|
|
}{
|
|
"empty": {
|
|
ExpectUserInfo: &user.DefaultInfo{
|
|
Name: user.Anonymous,
|
|
Groups: []string{},
|
|
},
|
|
},
|
|
"service-account": {
|
|
ServiceAccount: "sa",
|
|
ExpectUserInfo: &user.DefaultInfo{
|
|
Name: "system:serviceaccount:default:sa",
|
|
Groups: []string{},
|
|
},
|
|
},
|
|
"user-with-groups": {
|
|
UserInfo: &authv1.UserInfo{
|
|
Username: "user",
|
|
Groups: []string{"group0", "kubevela:group1", "kubevela:group2"},
|
|
},
|
|
ServiceAccount: "override",
|
|
ExpectUserInfo: &user.DefaultInfo{
|
|
Name: "user",
|
|
Groups: []string{"kubevela:group1", "kubevela:group2"},
|
|
},
|
|
},
|
|
}
|
|
for name, tt := range testCases {
|
|
t.Run(name, func(t *testing.T) {
|
|
r := require.New(t)
|
|
app := &v1beta1.Application{}
|
|
app.SetNamespace("default")
|
|
if tt.UserInfo != nil {
|
|
SetUserInfoInAnnotation(&app.ObjectMeta, *tt.UserInfo)
|
|
}
|
|
if tt.ServiceAccount != "" {
|
|
metav1.SetMetaDataAnnotation(&app.ObjectMeta, oam.AnnotationApplicationServiceAccountName, tt.ServiceAccount)
|
|
}
|
|
r.Equal(tt.ExpectUserInfo, GetUserInfoInAnnotation(&app.ObjectMeta))
|
|
})
|
|
}
|
|
}
|