| 6 | // |
| 7 | // https://www.apache.org/licenses/LICENSE-2.0 |
| 8 | // |
| 9 | // Unless required by applicable law or agreed to in writing, software |
| 10 | // distributed under the License is distributed on an "AS IS" BASIS, |
| 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 12 | // See the License for the specific language governing permissions and |
| 13 | // limitations under the License. |
| 14 |
| 15 | package testconfig |
| 16 |
| 17 | import ( |
| 18 | "encoding/json" |
| 19 | "os" |
| 20 | ) |
| 21 |
| 22 | type Test struct { |
| 23 | Cmd []string `json:"cmd"` |
| 24 | Env []string `json:"env"` |
| 25 | SkipSDE bool `json:"skip_sde"` |
| 26 | Shard bool `json:"shard"` |
| 27 | } |
| 28 |
| 29 | func ParseTestConfig(filename string) ([]Test, error) { |
| 30 | in, err := os.Open(filename) |
| 31 | if err != nil { |
| 32 | return nil, err |
| 33 | } |
| 34 | defer in.Close() |
| 35 |
| 36 | decoder := json.NewDecoder(in) |
| 37 | var result []Test |
| 38 | if err := decoder.Decode(&result); err != nil { |
| 39 | return nil, err |
| 40 | } |
| 41 | return result, nil |
| 42 | } |
| 43 |