Skip to content

Commit 9101dba

Browse files
committed
neutralize the need for docke container for running all the test case
1 parent e58ebc4 commit 9101dba

File tree

1 file changed

+33
-53
lines changed

1 file changed

+33
-53
lines changed

CONTRIBUTING.md

Lines changed: 33 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -22,14 +22,10 @@ We welcome various types of contributions:
2222

2323
Before you begin, ensure you have the following installed on your system:
2424

25-
- **Docker** - Required for containerized development and testing
26-
- **Docker Compose** - Used for orchestrating multi-container setups
2725
- **Git** - For version control
2826
- **Ruby** - For running Rake tasks
29-
30-
> **Note:** All development work is done in Docker containers, so you don't need Ruby installed on your host machine, but it's helpful for running Rake tasks.
31-
32-
The instructions below assume you are in the locally cloned project root directory (`apm-ruby`).
27+
- **Docker** - (Optional) Required for containerized development and testing
28+
- **Docker Compose** - (Optional) Used for some rake tests that start the container
3329

3430
### Getting Started
3531

@@ -49,7 +45,7 @@ The instructions below assume you are in the locally cloned project root directo
4945

5046
## Host Machine Setup
5147

52-
For development, you'll need a host environment capable of running Rake tasks to manage development and testing containers. We recommend using [rbenv](https://github.com/rbenv/rbenv) for Ruby version management.
48+
We recommend using [rbenv](https://github.com/rbenv/rbenv) for Ruby version management.
5349

5450
### 1. Install rbenv
5551

@@ -71,35 +67,22 @@ sudo apt install rbenv
7167

7268
```bash
7369
git clone https://github.com/rbenv/rbenv.git ~/.rbenv
70+
git clone https://github.com/rbenv/ruby-build.git ~/.rbenv/plugins/ruby-build
7471
echo 'eval "$(~/.rbenv/bin/rbenv init - bash)"' >> ~/.bashrc # for bash
7572
echo 'eval "$(~/.rbenv/bin/rbenv init - zsh)"' >> ~/.zshrc # for zsh
73+
source ~/.bashrc # for bash
74+
source ~/.zshrc # for zsh
7675
```
7776

7877
### 2. Install and Configure Ruby
7978

80-
Install Ruby using rbenv:
81-
82-
```bash
83-
# List latest stable versions
84-
rbenv install -l
85-
86-
# List all available versions
87-
rbenv install -L
88-
89-
# Install the desired Ruby version
90-
rbenv install 3.1.2
91-
```
92-
93-
Enable rbenv by following the initialization instructions:
79+
Install Ruby using rbenv, enable rbenv, and set the global Ruby version
9480

9581
```bash
9682
rbenv init
97-
```
98-
99-
Set the global Ruby version (this prevents conflicts within development containers):
100-
101-
```bash
102-
rbenv global 3.1.2 # Set the default Ruby version for this machine
83+
rbenv install -L # List all available versions
84+
rbenv install 3.1.2 # Install the desired Ruby version
85+
rbenv global 3.1.2 # Set the default Ruby version for this machine
10386
```
10487

10588
### 3. Install Project Dependencies
@@ -108,23 +91,23 @@ Install Bundler and configure it for development:
10891

10992
```bash
11093
gem install bundler
111-
bundle config set --local without development test
11294
bundle install
11395
```
11496

115-
Verify the setup by listing available Rake tasks:
97+
## Development Workflow
11698

117-
```bash
118-
bundle exec rake -T
119-
```
99+
### Development Environment
120100

121-
You should see tasks like `docker_dev`, `docker_tests`, `build_gem`, etc.
101+
You can use your host machine for building, installing, and testing.
122102

123-
## Development Workflow
103+
```bash
104+
# e.g. running all test case after update
105+
APM_RUBY_TEST_KEY=your_service_key test/run_tests.sh
106+
```
124107

125-
### Setting Up the Development Environment
108+
### Development Environment inside Container
126109

127-
The `solarwinds_apm` gem requires a Linux runtime environment. We use Ubuntu containers with all necessary tools for building, installing, and working with the project.
110+
You can use Ubuntu containers with all necessary tools for building, installing, and working with the project.
128111

129112
#### Starting the Development Container
130113

@@ -137,16 +120,10 @@ bundle exec rake docker_dev
137120
Once inside the container, set up the environment:
138121

139122
```bash
140-
# Choose and set the Ruby version (check available versions)
141-
rbenv versions
142-
rbenv global <some-version>
143-
144-
# Install project dependencies
145-
bundle install
123+
rbenv global <some-version> # Choose and set the Ruby version (check available versions)
124+
bundle install # Install project dependencies
146125
```
147126

148-
#### Working in the Development Container
149-
150127
The development container provides a complete environment for:
151128

152129
- Building and testing the gem
@@ -160,17 +137,20 @@ All source code is mounted from your host machine, so changes are immediately re
160137

161138
#### Building the Gem
162139

163-
Build the gem within the development container:
140+
Build the gem:
164141

165142
```bash
166-
# Build the gem
167-
bundle exec rake build_gem
143+
bundle exec rake build_gem # Build the gem
144+
gem install builds/solarwinds_apm-<version>.gem # Install the built gem locally
145+
SW_APM_SERVICE_KEY=<api-token:service-name> irb -r solarwinds_apm # Test the installation by loading the gem
146+
```
168147

169-
# Install the built gem locally
170-
gem install builds/solarwinds_apm-<version>.gem
148+
Build the gem without rake task:
171149

172-
# Test the installation by loading the gem
173-
SW_APM_SERVICE_KEY=<api-token:service-name> irb -r solarwinds_apm
150+
```bash
151+
gem build solarwinds_apm.gemspec # Build the gem
152+
gem install solarwinds_apm-<version>.gem # Install the built gem locally
153+
SW_APM_SERVICE_KEY=<api-token:service-name> irb -r solarwinds_apm # Test the installation by loading the gem
174154
```
175155

176156
#### Making Changes
@@ -215,7 +195,7 @@ bundle exec ruby -I test test/opentelemetry/solarwinds_propagator_test.rb
215195
bundle exec ruby -I test test/opentelemetry/solarwinds_propagator_test.rb -n /trace_state_header/
216196
```
217197

218-
### Running the Complete Test Suite From the Host Machine
198+
### Running the Complete Test Suite inside Container From the Host Machine
219199

220200
Execute the full test suite from the host machine:
221201

@@ -243,7 +223,7 @@ Tests are organized in the `test/` directory:
243223

244224
### Linting
245225

246-
We use RuboCop for code style enforcement. Run linting in the development container:
226+
We use RuboCop for code style enforcement. Run linting:
247227

248228
```bash
249229
bundle exec rake rubocop

0 commit comments

Comments
 (0)