Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The script examples/test.sh doesn't work as expected. #77

Closed
niconical opened this issue May 29, 2023 · 1 comment · Fixed by #78
Closed

The script examples/test.sh doesn't work as expected. #77

niconical opened this issue May 29, 2023 · 1 comment · Fixed by #78

Comments

@niconical
Copy link
Contributor

niconical commented May 29, 2023

Bug Report

1. Minimal reproduce step (Required)

This script contains four questions:

  1. Not all Makefiles of the instance contain the make test command, for example, the Makefile under the abstraction folder does not contain the test command
  2. set -e does not work, especially when I use a version of KCL that itself contains errors
  3. It is difficult to distinguish the output of each sample
  4. Even if an error occurs during execution, "Test success" is still displayed.

Minimal reproduce step:

  1. install KCLVM
  2. git clone https://github.com/KusionStack/kcl-lang.io.git && cd kcl-lang.io/examples && ./test.sh

2. What did you expect to see? (Required)

  1. Repair the test command of the Makefile under the abstraction folder
  2. If the script sets the set -e flag, when the script encounters an execution error, it will stop immediately
  3. Better display of results for each test case
  4. If an error occurs during execution, it will display "Test FAILED".
image

3. What did you see instead (Required)

  1. The script will continue to execute even if an error is encountered
  2. The abstraction Makefile lacks the make test command
  3. Difficult to tell what is wrong with each example
  4. Even if an error occurs during execution, "Test success" is still displayed.
Testing configuration ...
make nginx
make[1]: Entering directory '/home/ch/kcl-lang.io/examples/configuration'
kcl nginx.k
nginx:
  http:
    server:
      listen: 80
      location:
        root: /var/www/html
        index: index.html
make[1]: Leaving directory '/home/ch/kcl-lang.io/examples/configuration'
make db
make[1]: Entering directory '/home/ch/kcl-lang.io/examples/configuration'
kcl db.k
env: dev
database: ~
hosts:
  dev: postgres.dev
  stage: postgres.stage
  prod: postgres.prod
dbConfig:
  host: postgres.dev
  database: ~
  port: "2023"
  conn: "postgres://postgres.dev:2023/None"
make[1]: Leaving directory '/home/ch/kcl-lang.io/examples/configuration'
Test success - configuration
Testing validation ...
make run
make[1]: Entering directory '/home/ch/kcl-lang.io/examples/validation'
kcl-vet data.json schema.k
While deleting: %kclvm_value_ref_t** %$backtrack_cache
Use still stuck around after Def is destroyed:  %"$backtrack_cache6" = load %kclvm_value_ref_t*, %kclvm_value_ref_t** %"$backtrack_cache", align 8
kclvm_cli: /home/ch/llvm-12.0.0.src/lib/IR/Value.cpp:100: llvm::Value::~Value(): Assertion `materialized_use_empty() && "Uses remain when a value is destroyed!"' failed.
Aborted (core dumped)
make[1]: *** [Makefile:2: run] Error 134
make[1]: Leaving directory '/home/ch/kcl-lang.io/examples/validation'
make: *** [Makefile:5: test] Error 2
Test success - validation
Testing abstraction ...
make: *** No rule to make target 'test'.  Stop.
Test success - abstraction
Testing definition ...
make run
make[1]: Entering directory '/home/ch/kcl-lang.io/examples/definition'
kcl main.k
While deleting: %kclvm_value_ref_t** %$backtrack_cache
Use still stuck around after Def is destroyed:  %"$backtrack_cache6" = load %kclvm_value_ref_t*, %kclvm_value_ref_t** %"$backtrack_cache", align 8
kclvm_cli: /home/ch/llvm-12.0.0.src/lib/IR/Value.cpp:100: llvm::Value::~Value(): Assertion `materialized_use_empty() && "Uses remain when a value is destroyed!"' failed.
Aborted (core dumped)
make[1]: *** [Makefile:2: run] Error 134
make[1]: Leaving directory '/home/ch/kcl-lang.io/examples/definition'
make: *** [Makefile:5: test] Error 2
Test success - definition
Testing mutation ...
make run
make[1]: Entering directory '/home/ch/kcl-lang.io/examples/mutation'
kcl -Y kcl.yaml
items:
  - apiVersion: apps/v1
    kind: Deployment
    metadata:
      labels:
        app: nginx
      name: nginx-deployment
    spec:
      replicas: 4
      selector:
        matchLabels:
          app: nginx
      template:
        metadata:
          labels:
            app: nginx
        spec:
          containers:
            - image: "nginx:1.14.2"
              name: nginx
              ports:
                - containerPort: 80
make[1]: Leaving directory '/home/ch/kcl-lang.io/examples/mutation'
Test success - mutation
Testing data-integration ...
make yaml
make[1]: Entering directory '/home/ch/kcl-lang.io/examples/data-integration'
kcl yaml.k
server:
  ports:
    - 80
    - 8080
server_yaml: "ports:\n  - 80\n  - 8080\n"
make[1]: Leaving directory '/home/ch/kcl-lang.io/examples/data-integration'
make json
make[1]: Entering directory '/home/ch/kcl-lang.io/examples/data-integration'
kcl json.k
server:
  ports:
    - 80
    - 8080
server_json: "{\"ports\": [80, 8080]}"
make[1]: Leaving directory '/home/ch/kcl-lang.io/examples/data-integration'
Test success - data-integration
Testing automation ...
make update
make[1]: Entering directory '/home/ch/kcl-lang.io/examples/automation'
kcl main.k -O app.name='new_app'
app:
  name: new_app
  replicas: 1
  labels:
    app: new_app
    key: value
make[1]: Leaving directory '/home/ch/kcl-lang.io/examples/automation'
make delete
make[1]: Entering directory '/home/ch/kcl-lang.io/examples/automation'
kcl main.k -O app.labels.key-
app:
  name: app
  replicas: 1
  labels:
    app: app
make[1]: Leaving directory '/home/ch/kcl-lang.io/examples/automation'
Test success - automation

4. What is your KusionStack components version? (Required)

This error comes from a version of KCL that contained a bug of its own, which I discovered when I was trying to fix this issue.

@niconical niconical changed the title bug: The script examples/test.sh set -e flag doesn't work as expected. The script examples/test.sh doesn't work as expected. May 29, 2023
@niconical
Copy link
Contributor Author

I will try to fix this problem.

@niconical niconical mentioned this issue May 29, 2023
16 tasks
@Peefy Peefy closed this as completed in #78 May 31, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant