Skip to content
This repository was archived by the owner on Dec 6, 2022. It is now read-only.

Commit 6b67fb0

Browse files
author
Isaac Hollander McCreery
committed
Merge contributing information in README into CONTRIBUTING, plus other updates to the documentation around contributing
1 parent 9105d5b commit 6b67fb0

File tree

3 files changed

+23
-50
lines changed

3 files changed

+23
-50
lines changed

CONTRIBUTING.md

+20-7
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,20 @@
22

33
New contributors are always welcome, and when in doubt please ask questions! We strive to be an open and welcoming community. Please be nice to one another.
44

5+
I recommend heading over to fog's [CONTRIBUTING](https://github.com/fog/fog/blob/master/CONTRIBUTING.md) and having a look around as well. It has information and context about the state of the `fog` project as a whole.
6+
57
### Coding
68

79
* Pick a task:
810
* Offer feedback on open [pull requests](https://github.com/fog/fog-google/pulls).
911
* Review open [issues](https://github.com/fog/fog-google/issues) for things to help on.
1012
* [Create an issue](https://github.com/fog/fog-google/issues/new) to start a discussion on additions or features.
1113
* Fork the project, add your changes and tests to cover them in a topic branch.
14+
* [Fork](https://github.com/fog/fog-google/fork)
15+
* Create your feature branch (`git checkout -b my-new-feature`)
16+
* Commit your changes (`git commit -am 'Add some feature'`)
17+
* Push to the branch (`git push origin my-new-feature`)
18+
* Create a new pull request
1219
* Commit your changes and rebase against `fog/fog-google` to ensure everything is up to date.
1320
* [Submit a pull request](https://github.com/fog/fog-google/compare/)
1421

@@ -17,17 +24,15 @@ New contributors are always welcome, and when in doubt please ask questions! We
1724
* Offer feedback on open [issues](https://github.com/fog/fog-google/issues).
1825
* Organize or volunteer at events.
1926

20-
I recommend heading over to fog's [CONTRIBUTING](https://github.com/fog/fog/blob/master/CONTRIBUTING.md) and having a look around as well. It has information and context about the state of the `fog` project as a whole.
21-
2227
## Contributing Code
2328

2429
This document is very much a work in progress. Sorry about that.
2530

26-
### Testing
31+
It's worth noting that, if you're looking through the code, and you'd like to know the history of a line, you may not find it in the history of this repository, since most of the code was extracted from [fog/fog]. So, you can look at the history from commit [fog/fog#c596e] backward for more information.
2732

28-
We're in the middle of switching from using `shindo` to `minitest` as our testing framework. Right now, the `shindo` tests in `test/` work in mocking mode, but don't work when mocking is turned off. To start, we'll only be writing live integration tests in our `minitest` suite, and we'll hopefully flesh out mocks later down the line, (perhaps when a more stable mocking framework for the whole `fog` ecosystem is worked out; for example, see [fog/fog#1252](https://github.com/fog/fog/issues/1252)).
33+
### Testing
2934

30-
If you'd like to run live integration tests for `Fog::Compute`, you need a `:test` configuration in `~/.fog`. Something like:
35+
This module is tested with [Minitest](https://github.com/seattlerb/minitest). Right now, the only tests that exist are live integration tests, found in `test/integration/`. After completing the installation above, (including setting up your credentials and keys,) make sure you have a `:test` credential in `~/.fog`, something like:
3136

3237
```
3338
test:
@@ -37,7 +42,9 @@ test:
3742
google_json_key_location: /path/to/my-project-xxxxxxxxxxxxx.json
3843
```
3944

40-
Then you can run all the tests:
45+
Note that you need both a `.p12` and a `.json` key file for all the tests to pass.
46+
47+
Then you can run all the live tests:
4148

4249
```shell
4350
$ rake test
@@ -51,4 +58,10 @@ $ rake test TEST=test/integration/compute/test_servers.rb TESTOPTS="--name=TestS
5158

5259
#### Some notes about the tests as they stand
5360

54-
- The images tests reference the `fog-test-raw-disk-source.image.tar.gz` image created [like so](https://cloud.google.com/compute/docs/images#export_an_image_to_google_cloud_storage).
61+
The live integration tests for resources, (servers, disks, etc.,) have a few components:
62+
63+
- The `TestCollection` **mixin module** lives in `test/helpers/test_collection.rb` and contains the standard tests to run for all resources, (e.g. `test_lifecycle`). It also calls `cleanup` on the resource's factory during teardown, to make sure that resources are getting destroyed before the next test run.
64+
- The **factory**, (e.g. `ServersFactory`, in `test/factories/servers_factory.rb`,) automates the creation of resources and/or supplies parameters for explicit creation of resources. For example, `ServersFactory` initializes a `DisksFactory` to supply disks in order to create servers, and implements the `params` method so that tests can create servers with unique names, correct zones and machine types, and automatically-created disks. `ServersFactory` inherits the `create` method from `CollectionFactory`, which allows tests to create servers on-demand.
65+
- The **main test**, (e.g. `TestServers`, in `test/integration/compute/test_servers.rb`,) is the test that actually runs. It mixes in the `TestCollection` module in order to run the tests in that module, it supplies the `setup` method in which it initializes a `ServersFactory`, and it includes any other tests specific to this collection, (e.g. `test_bootstrap_ssh_destroy`).
66+
67+
If you want to create another resource, you should add live integration tests; all you need to do is create a factory in `test/factories/my_resource_factory.rb` and a main test in `test/integration/compute/test_my_resource.rb` that mixes in `TestCollection`.

README.md

+1-42
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,6 @@ Follow the [instructions to generate a private key](https://cloud.google.com/sto
6060
my_credential:
6161
google_project: my-project
6262
google_client_email: xxxxxxxxxxxx-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx@developer.gserviceaccount.com
63-
google_key_location: /path/to/my-project-xxxxxxxxxxxx.p12
6463
google_json_key_location: /path/to/my-project-xxxxxxxxxxxx.json
6564
```
6665

@@ -70,44 +69,4 @@ If you want to be able to bootstrap SSH-able instances, (using `servers.bootstra
7069

7170
## Contributing
7271

73-
1. Fork it ( https://github.com/fog/fog-google/fork )
74-
2. Create your feature branch (`git checkout -b my-new-feature`)
75-
3. Commit your changes (`git commit -am 'Add some feature'`)
76-
4. Push to the branch (`git push origin my-new-feature`)
77-
5. Create a new Pull Request
78-
79-
It's worth noting that, if you're looking through the code, and you'd like to know the history of a line, you may not find it in the history of this repository, since most of the code was extracted from [fog/fog]. So, you can look at the history from commit [fog/fog#c596e] backward for more information.
80-
81-
### Testing
82-
83-
This module is tested with [Minitest](https://github.com/seattlerb/minitest). Right now, the only tests that exist are live integration tests, found in `test/integration/`. After completing the installation above, (including setting up your credentials and keys,) make sure you have a `:test` credential in `~/.fog`, for example:
84-
85-
```
86-
test:
87-
google_project: my-project
88-
google_client_email: xxxxxxxxxxxx-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx@developer.gserviceaccount.com
89-
google_key_location: /path/to/my-project-xxxxxxxxxxxx.p12
90-
google_json_key_location: /path/to/my-project-xxxxxxxxxxxx.json
91-
```
92-
93-
Note that you need both a `.p12` and a `.json` key file for all the tests to pass.
94-
95-
Then, you can run the live tests with:
96-
97-
```shell
98-
$ rake test
99-
```
100-
101-
If you'd like to just run one test or test file, use the `TEST`argument:
102-
103-
```shell
104-
$ rake test TEST=test/integration/compute/test_servers.rb
105-
```
106-
107-
The live integration tests for resources, (servers, disks, etc.,) have a few components:
108-
109-
- The `TestCollection` **mixin module** lives in `test/helpers/test_collection.rb` and contains the standard tests to run for all resources, (e.g. `test_lifecycle`). It also calls `cleanup` on the resource's factory during teardown, to make sure that resources are getting destroyed before the next test run.
110-
- The **factory**, (e.g. `ServersFactory`, in `test/factories/servers_factory.rb`,) automates the creation of resources and/or supplies parameters for explicit creation of resources. For example, `ServersFactory` initializes a `DisksFactory` to supply disks in order to create servers, and implements the `params` method so that tests can create servers with unique names, correct zones and machine types, and automatically-created disks. `ServersFactory` inherits the `create` method from `CollectionFactory`, which allows tests to create servers on-demand.
111-
- The **main test**, (e.g. `TestServers`, in `test/integration/compute/test_servers.rb`,) is the test that actually runs. It mixes in the `TestCollection` module in order to run the tests in that module, it supplies the `setup` method in which it initializes a `ServersFactory`, and it includes any other tests specific to this collection, (e.g. `test_bootstrap_ssh_destroy`).
112-
113-
If you want to create another resource, you should add live integration tests; all you need to do is create a factory in `test/factories/my_resource_factory.rb` and a main test in `test/integration/compute/test_my_resource.rb` that mixes in `TestCollection`.
72+
See `CONTRIBUTING.md` in this repository.

test/minitest_helper.rb

+2-1
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,8 @@
2828
TEST_REGION = "us-central1"
2929
TEST_SIZE_GB = 10
3030
TEST_MACHINE_TYPE = "n1-standard-1"
31-
# XXX this depends on a public image in gs://fog-test-bucket; there may be a better way to do this
31+
# XXX This depends on a public image in gs://fog-test-bucket; there may be a better way to do this
32+
# The image was created like so: https://cloud.google.com/compute/docs/images#export_an_image_to_google_cloud_storage
3233
TEST_RAW_DISK_SOURCE = "http://storage.googleapis.com/fog-test-bucket/fog-test-raw-disk-source.image.tar.gz"
3334

3435
class FogIntegrationTest < MiniTest::Test

0 commit comments

Comments
 (0)