Skip to content

Conversation

@agithomas
Copy link
Contributor

@agithomas agithomas commented Oct 18, 2022

Tested with below configuration


version: '2.3'
services:
  docker-custom-agent:
    #build: https://raw.githubusercontent.com/agithomas/integrations/issue-4405/packages/oracle/data_stream/memory/_dev/deploy/agent/Dockerfile
    build:
      context: .
      dockerfile: Dockerfile
    image: elastic-agent-oracle-client
    # volumes:
    #   - ${SERVICE_LOGS_DIR}:/opt/oracle/oradata
    healthcheck:
      test: ["CMD", "bash", "-c", "echo 'select 1 from dual;' | ORACLE_HOME=/opt/oracle/instantclient_21_4 /opt/oracle/instantclient_21_4/sqlplus -s sys/Oradoc_db1@oracle:1521/ORCLCDB.localdomain?sysdba=1"]
      interval: 10s
      timeout: 10s
      retries: 60
    user: root
  oracle:
    image: docker.elastic.co/observability-ci/database-enterprise:12.2.0.1
    ports:
      - 1521:1521
      - 5500:5500

Fixes #997

@agithomas
Copy link
Contributor Author

t-base.yml -p elastic-package-service down --volumes
Stopping elastic-package-service_docker-custom-agent_1 ... done
Stopping elastic-package-service_oracle_1              ... done
WARNING: Found orphan containers (elastic-package-service_oracle-database-audit-logfile_1) for this project. If you removed or renamed this service in your compose file, you can run this command with the --remove-orphans flag to clean it up.
Removing elastic-package-service_docker-custom-agent_1 ... done
Removing elastic-package-service_oracle_1              ... done
Removing network elastic-package-service_default
2022/10/18 09:58:40 DEBUG deleting data in data stream...
--- Test results for package: oracle - START ---
╭─────────┬─────────────┬───────────┬───────────┬────────┬─────────────────╮
│ PACKAGE │ DATA STREAM │ TEST TYPE │ TEST NAME │ RESULT │    TIME ELAPSED │
├─────────┼─────────────┼───────────┼───────────┼────────┼─────────────────┤
│ oracle  │ memory      │ system    │ memory    │ PASS   │ 3m25.531497298s │
╰─────────┴─────────────┴───────────┴───────────┴────────┴─────────────────╯
--- Test results for package: oracle - END   ---
Done

@agithomas agithomas self-assigned this Oct 18, 2022
@elasticmachine
Copy link
Collaborator

elasticmachine commented Oct 18, 2022

💚 Build Succeeded

the below badges are clickable and redirect to their specific view in the CI or DOCS
Pipeline View Test View Changes Artifacts preview preview

Expand to view the summary

Build stats

  • Start Time: 2022-11-02T10:18:58.088+0000

  • Duration: 31 min 58 sec

Test stats 🧪

Test Results
Failed 0
Passed 863
Skipped 0
Total 863

🤖 GitHub comments

Expand to view the GitHub comments

To re-run your PR in the CI, just comment with:

  • /test : Re-trigger the build.

Copy link
Member

@jsoriano jsoriano left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍 Looks good, could you please add a test package and update the docs in docs/howto/system_testing.md?

@elasticmachine
Copy link
Collaborator

elasticmachine commented Oct 18, 2022

🌐 Coverage report

Name Metrics % (covered/total) Diff
Packages 100.0% (35/35) 💚
Files 66.667% (86/129) 👍
Classes 61.413% (113/184) 👍
Methods 47.662% (367/770) 👍 0.143
Lines 30.723% (3288/10702) 👍
Conditionals 100.0% (0/0) 💚

@agithomas
Copy link
Contributor Author

Ran the below command:

PACKAGE_TEST_TYPE=custom-agent-multiservice ./scripts/test-check-packages.sh

Received Output as below.


2022/10/18 11:24:52 DEBUG running command: /usr/local/bin/docker-compose -f /home/agikthomas/.elastic-package/profiles/default/stack/snapshot.yml -p elastic-package-stack down --volumes --remove-orphans
Stopping elastic-package-stack_elastic-agent_1    ... done
Stopping elastic-package-stack_fleet-server_1     ... done
Stopping elastic-package-stack_kibana_1           ... done
Stopping elastic-package-stack_elasticsearch_1    ... done
Stopping elastic-package-stack_package-registry_1 ... done
Removing elastic-package-stack_elastic-agent_is_ready_1    ... done
Removing elastic-package-stack_elastic-agent_1             ... done
Removing elastic-package-stack_fleet-server_is_ready_1     ... done
Removing elastic-package-stack_fleet-server_1              ... done
Removing elastic-package-stack_kibana_is_ready_1           ... done
Removing elastic-package-stack_kibana_1                    ... done
Removing elastic-package-stack_elasticsearch_is_ready_1    ... done
Removing elastic-package-stack_package-registry_is_ready_1 ... done
Removing elastic-package-stack_elasticsearch_1             ... done
Removing elastic-package-stack_package-registry_1          ... done
Removing network elastic-package-stack_default
Done
+ for d in test/packages/${PACKAGE_TEST_TYPE:-other}/${PACKAGE_UNDER_TEST:-*}/
+ cd test/packages/custom-agent-multiservice/oracle/
+ elastic-package clean -v
2022/10/18 11:25:03 DEBUG Enable verbose logging
2022/10/18 11:25:03 DEBUG Distribution built without a version tag, can't determine release chronology. Please consider using official releases at https://github.com/elastic/elastic-package/releases
Clean used resources
2022/10/18 11:25:03 DEBUG Clean build resources
2022/10/18 11:25:03 DEBUG Build directory for integration: /home/agikthomas/go/src/github.com/elastic/elastic-package/build/packages/oracle
2022/10/18 11:25:03 DEBUG Remove directory (path: /home/agikthomas/go/src/github.com/elastic/elastic-package/build/packages/oracle)
2022/10/18 11:25:03 DEBUG Remove zipped built package (path: /home/agikthomas/go/src/github.com/elastic/elastic-package/build/packages/oracle-999.999.999.zip)
Build resources removed: /home/agikthomas/go/src/github.com/elastic/elastic-package/build/packages/oracle
2022/10/18 11:25:03 DEBUG Clean built packages from the development stack
2022/10/18 11:25:03 DEBUG Stack package is not part of the development stack (missing path: /home/agikthomas/.elastic-package/stack/development/oracle)
2022/10/18 11:25:03 DEBUG Clean all service logs
2022/10/18 11:25:03 DEBUG Remove folder content (path: /home/agikthomas/.elastic-package/tmp/service_logs)
Temporary service logs removed: /home/agikthomas/.elastic-package/tmp/service_logs
Done
+ exit 1

The pipeline will break because of the errors


Error: checking package failed: linting package failed: found 2 validation errors:
   1. item [Dockerfile] is not allowed in folder [/home/agikthomas/go/src/github.com/elastic/elastic-package/test/packages/custom-agent-multiservice/oracle/data_stream/memory/_dev/deploy/agent]
   2. file "/home/agikthomas/go/src/github.com/elastic/elastic-package/test/packages/custom-agent-multiservice/oracle/data_stream/memory/_dev/deploy/agent/custom-agent.yml" is invalid: field services: Additional property oracle is not allowed

To fix these errors, below mentioned PRs must be merged with main

elastic/package-spec#436

@jsoriano
Copy link
Member

To fix these errors, below mentioned PRs must be merged with main

elastic/package-spec#436

Ok, let's wait to merge this one first. Thanks for adding tests files!

@agithomas
Copy link
Contributor Author

agithomas commented Oct 19, 2022

It appears that elastic-package must use the latest package-spec to avoid the below mentioned error


[2022-10-19T06:16:59.414Z] Error: checking package failed: linting package failed: found 2 validation errors:

[2022-10-19T06:16:59.414Z]    1. item [Dockerfile] is not allowed in folder [/var/lib/jenkins/workspace/PR-1009-4-43d0ae6c-730f-4db1-8e00-66e0b7e3f21c/src/github.com/elastic/elastic-package/test/packages/custom-agent-multiservice/oracle/data_stream/memory/_dev/deploy/agent]

[2022-10-19T06:16:59.414Z]    2. file "/var/lib/jenkins/workspace/PR-1009-4-43d0ae6c-730f-4db1-8e00-66e0b7e3f21c/src/github.com/elastic/elastic-package/test/packages/custom-agent-multiservice/oracle/data_stream/memory/_dev/deploy/agent/custom-agent.yml" is invalid: field services: Additional property oracle is not allowed

[2022-10-19T06:16:59.414Z] 

[2022-10-19T06:16:59.414Z] + cleanup

[2022-10-19T06:16:59.414Z] + r=1

@jsoriano , is this something that you can help me with ?

@jsoriano
Copy link
Member

Hey @agithomas, yes, we need to publish a new version of package-spec and include it here.

Something you can try in the meantime is to use the current main version of the package spec, with:

go mod edit -replace github.com/elastic/package-spec=github.com/elastic/package-spec@main

@agithomas
Copy link
Contributor Author

/test

@agithomas agithomas marked this pull request as draft October 25, 2022 11:40
@jsoriano
Copy link
Member

@agithomas thanks for giving a try to this PR with package-spec main branch. If build goes green I will release a new version of the spec so you can continue with this.

@agithomas agithomas marked this pull request as ready for review October 27, 2022 10:46
Copy link
Contributor

@mrodm mrodm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Minor comment about the location of the test packages.

Could you update docs/howto/system_testing.md to include this scenario under the section "Agent service deployer". It would be helpful for future references.

As @jsoriano mentioned here #1009 (comment), as the latest Jenkins build was successful, I will proceed to release a new package-spec version (v2.1.0).

Once this release is done and updated in elastic-package, you could update your branch with main branch and remove the replace in go.mod file too.

@mrodm
Copy link
Contributor

mrodm commented Oct 28, 2022

/test

@agithomas
Copy link
Contributor Author

@mrodm , @jsoriano , There exists a problem in elastic-package related to the cleanup of docker-custom-agent due to which the problem appears and the pipeline breaks .

This issue is re-created while manual doing run as well

The second run of the test fails.

I have identified a fix and i am adding to this PR change to check if it works.

It worked perfectly in local environment testing.

@mrodm
Copy link
Contributor

mrodm commented Oct 28, 2022

@agithomas package-spec 2.1.0 has been merged in elastic-package #1022.
You can update your branch and remove the usage of main version of package-spec from go.mod and go.sum files (f01b0ae)

@mrodm
Copy link
Contributor

mrodm commented Oct 28, 2022

@mrodm , @jsoriano , There exists a problem in elastic-package related to the cleanup of docker-custom-agent due to which the problem appears and the pipeline breaks .

This issue is re-created while manual doing run as well

The second run of the test fails.

I have identified a fix and i am adding to this PR change to check if it works.

It worked perfectly in local environment testing.

One option to not block this PR for this fix could be (as the feature has already been tested):

  1. Move again the test package to its own target (as you had previously)
    • that would mean that Jenkins jobs finishes successfully 🤞 , and we could merge it
  2. Create another PR with the fix that you have been testing

WDYT ?

@agithomas
Copy link
Contributor Author

@mrodm , @jsoriano , There exists a problem in elastic-package related to the cleanup of docker-custom-agent due to which the problem appears and the pipeline breaks .
This issue is re-created while manual doing run as well
The second run of the test fails.
I have identified a fix and i am adding to this PR change to check if it works.
It worked perfectly in local environment testing.

One option to not block this PR for this fix could be (as the feature has already been tested):

  1. Move again the test package to its own target (as you had previously)

    • that would mean that Jenkins jobs finishes successfully 🤞 , and we could merge it
  2. Create another PR with the fix that you have been testing

WDYT ?

Did the rollback as per the above suggestion.

Will create a separate PR for the issue-fix related to policy

Copy link
Contributor

@mrodm mrodm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for addressing all the comments!

@agithomas agithomas merged commit 315df8e into elastic:main Nov 2, 2022
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 this pull request may close these issues.

Allow to run system tests with custom elastic-agent and a service

4 participants