Skip to content

Commit

Permalink
fix konfig integration test path
Browse files Browse the repository at this point in the history
  • Loading branch information
He1pa committed Sep 15, 2023
1 parent ea1d02b commit 7cc562b
Show file tree
Hide file tree
Showing 2 changed files with 50 additions and 27 deletions.
76 changes: 49 additions & 27 deletions kclvm/tools/src/LSP/src/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -822,6 +822,7 @@ fn konfig_path() -> PathBuf {
.parent()
.unwrap()
.join("test")
.join("integration")
.join("konfig");
konfig_path
}
Expand Down Expand Up @@ -851,7 +852,7 @@ fn konfig_goto_def_test_base() {
expected_path.push("base/pkg/kusion_models/kube/frontend/server.k");
compare_goto_res(
res,
(&expected_path.to_str().unwrap().to_string(), 11, 0, 125, 39),
(&expected_path.to_str().unwrap().to_string(), 12, 0, 142, 31),
);

// schema def
Expand Down Expand Up @@ -881,9 +882,9 @@ fn konfig_goto_def_test_base() {
res,
(
&expected_path.to_str().unwrap().to_string(),
102,
115,
4,
102,
115,
17,
),
);
Expand Down Expand Up @@ -942,7 +943,7 @@ fn konfig_goto_def_test_main() {
expected_path.push("base/pkg/kusion_models/kube/frontend/server.k");
compare_goto_res(
res,
(&expected_path.to_str().unwrap().to_string(), 11, 0, 125, 39),
(&expected_path.to_str().unwrap().to_string(), 12, 0, 142, 31),
);

// schema attr
Expand All @@ -956,7 +957,13 @@ fn konfig_goto_def_test_main() {
expected_path.push("base/pkg/kusion_models/kube/frontend/server.k");
compare_goto_res(
res,
(&expected_path.to_str().unwrap().to_string(), 99, 4, 99, 22),
(
&expected_path.to_str().unwrap().to_string(),
112,
4,
112,
22,
),
);

// import pkg
Expand Down Expand Up @@ -1015,25 +1022,29 @@ fn konfig_completion_test_main() {
};
let got = completion(None, &program, &pos, &prog_scope).unwrap();
let attrs = [
"project",
"stack",
"frontend",
"service",
"container",
"res_tpl",
"rbac",
"backend",
"resource",
"metadata",
"apis",
"corev1",
"monitoringv1",
"monitoringv1alpha1",
"kubevelav1beta1",
"commons",
"vaultv1",
"manifests",
"__META_APP_NAME",
"__META_ENV_TYPE_NAME",
"__META_CLUSTER_NAME",
"appConfiguration",
"__output_standalone__",
"__output_ignore__",
"__output_inline__",
"checkIdentical",
"manifestsResourceMap",
"remove_duplicated_iter",
"__renderServerFrontendInstances__",
"__renderServerBackendInstances__",
"__renderJobFrontendInstances__",
Expand All @@ -1042,14 +1053,22 @@ fn konfig_completion_test_main() {
"__renderBackendInstances__",
"__rbac_map__",
"__prometheus_map__",
"__vault_map__",
"__k8s__",
"__array_of_resource_map___",
"__resource_map_original___",
"_providerResource",
"_providerResourceMapping",
"__resource_map___",
"konfig_kubeKubernetes",
"__is_kubevela_application__",
"getId",
"x",
"kubevela_app",
"kubevela_output",
"server_output",
"__settings__",
"name",
"workloadType",
"renderType",
"replicas",
"image",
"schedulingStrategy",
Expand All @@ -1070,6 +1089,8 @@ fn konfig_completion_test_main() {
"services",
"ingresses",
"serviceAccount",
"storage",
"database",
];
items.extend(attrs.iter().map(|item| KCLCompletionItem {
label: item.to_string(),
Expand All @@ -1086,20 +1107,21 @@ fn konfig_completion_test_main() {
};
let got = completion(Some('.'), &program, &pos, &prog_scope).unwrap();
let pkgs = [
"common",
"configmap",
"container",
"ingress",
"job",
"rbac",
"resource",
"secret",
"server",
"service",
"serviceaccount",
"sidecar",
"strategy",
"volume",
"common",
"configmap",
"container",
"ingress",
"job",
"rbac",
"resource",
"secret",
"server",
"service",
"serviceaccount",
"sidecar",
"storage",
"strategy",
"volume"
];
items.extend(pkgs.iter().map(|item| KCLCompletionItem {
label: item.to_string(),
Expand Down Expand Up @@ -1135,7 +1157,7 @@ fn konfig_hover_test_main() {
let expect: Vec<MarkedString> = vec![
"base.pkg.kusion_models.kube.frontend\n\nschema Server",
"Server is abstaction of Deployment and StatefulSet.",
"Attributes:\n\n__settings__?: {str:any}\n\nworkloadType: str(Deployment)|str(StatefulSet)\n\nreplicas: int\n\nimage: str\n\nschedulingStrategy: SchedulingStrategy\n\nmainContainer: Main\n\nsidecarContainers?: [Sidecar]\n\ninitContainers?: [Sidecar]\n\nuseBuiltInLabels?: bool\n\nlabels?: {str:str}\n\nannotations?: {str:str}\n\nuseBuiltInSelector?: bool\n\nselector?: {str:str}\n\npodMetadata?: ObjectMeta\n\nvolumes?: [Volume]\n\nneedNamespace?: bool\n\nenableMonitoring?: bool\n\nconfigMaps?: [ConfigMap]\n\nsecrets?: [Secret]\n\nservices?: [Service]\n\ningresses?: [Ingress]\n\nserviceAccount?: ServiceAccount"
"Attributes:\n\n__settings__?: {str:any}\n\nname?: str\n\nworkloadType: str(Deployment)|str(StatefulSet)\n\nrenderType?: str(Server)|str(KubeVelaApplication)\n\nreplicas: int\n\nimage: str\n\nschedulingStrategy: SchedulingStrategy\n\nmainContainer: Main\n\nsidecarContainers?: [Sidecar]\n\ninitContainers?: [Sidecar]\n\nuseBuiltInLabels?: bool\n\nlabels?: {str:str}\n\nannotations?: {str:str}\n\nuseBuiltInSelector?: bool\n\nselector?: {str:str}\n\npodMetadata?: ObjectMeta\n\nvolumes?: [Volume]\n\nneedNamespace?: bool\n\nenableMonitoring?: bool\n\nconfigMaps?: [ConfigMap]\n\nsecrets?: [Secret]\n\nservices?: [Service]\n\ningresses?: [Ingress]\n\nserviceAccount?: ServiceAccount\n\nstorage?: ObjectStorage\n\ndatabase?: DataBase"
]
.iter()
.map(|s| MarkedString::String(s.to_string()))
Expand Down
1 change: 1 addition & 0 deletions kclvm/tools/src/format/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,7 @@ fn test_format_integration_konfig() -> Result<()> {
.parent()
.unwrap()
.join("test")
.join("integration")
.join("konfig");
let files = get_files(konfig_path, true, true, ".k");
for file in &files {
Expand Down

0 comments on commit 7cc562b

Please sign in to comment.