You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Dec 6, 2022. It is now read-only.
Copy file name to clipboardexpand all lines: CONTRIBUTING.md
+20-7
Original file line number
Diff line number
Diff line change
@@ -2,13 +2,20 @@
2
2
3
3
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.
4
4
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
+
5
7
### Coding
6
8
7
9
* Pick a task:
8
10
* Offer feedback on open [pull requests](https://github.com/fog/fog-google/pulls).
9
11
* Review open [issues](https://github.com/fog/fog-google/issues) for things to help on.
10
12
*[Create an issue](https://github.com/fog/fog-google/issues/new) to start a discussion on additions or features.
11
13
* 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
12
19
* Commit your changes and rebase against `fog/fog-google` to ensure everything is up to date.
13
20
*[Submit a pull request](https://github.com/fog/fog-google/compare/)
14
21
@@ -17,17 +24,15 @@ New contributors are always welcome, and when in doubt please ask questions! We
17
24
* Offer feedback on open [issues](https://github.com/fog/fog-google/issues).
18
25
* Organize or volunteer at events.
19
26
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
-
22
27
## Contributing Code
23
28
24
29
This document is very much a work in progress. Sorry about that.
25
30
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.
27
32
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
29
34
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:
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:
41
48
42
49
```shell
43
50
$ rake test
@@ -51,4 +58,10 @@ $ rake test TEST=test/integration/compute/test_servers.rb TESTOPTS="--name=TestS
51
58
52
59
#### Some notes about the tests as they stand
53
60
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`.
@@ -70,44 +69,4 @@ If you want to be able to bootstrap SSH-able instances, (using `servers.bootstra
70
69
71
70
## Contributing
72
71
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:
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`.
0 commit comments