Documentation ¶
Overview ¶
Copyright 2020 The OpenEBS Authors.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Copyright 2020 The OpenEBS Authors.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Copyright 2020 The OpenEBS Authors.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Copyright 2020 The OpenEBS Authors.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Copyright 2020 The OpenEBS Authors.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Copyright 2020 The OpenEBS Authors.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Copyright 2020 The OpenEBS Authors.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Copyright 2020 The OpenEBS Authors.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Copyright 2020 The OpenEBS Authors.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Index ¶
- type PoolMocker
- func (poolMocker *PoolMocker) Add(cmd string) ([]byte, error)
- func (poolMocker *PoolMocker) Create(cmd string) ([]byte, error)
- func (poolMocker *PoolMocker) Delete(cmd string) ([]byte, error)
- func (poolMocker *PoolMocker) Dump(cmd string) ([]byte, error)
- func (poolMocker *PoolMocker) GetProperty(cmd string) ([]byte, error)
- func (poolMocker *PoolMocker) Import(cmd string) ([]byte, error)
- func (poolMocker *PoolMocker) LabelClear(cmd string) ([]byte, error)
- func (poolMocker *PoolMocker) Replace(cmd string) ([]byte, error)
- func (poolMocker *PoolMocker) SetProperty(cmd string) ([]byte, error)
- type TestConfig
- type ZpoolCommandError
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type PoolMocker ¶
type PoolMocker struct { // Topology holds the vdev topology of the pool Topology *internalapi.Topology // PoolName holds the cstor pool name PoolName string // DataRaidGroupType represents the type of the data raid group DataRaidGroupType string // WriteCacheRaidGroupType represents the type of the write cache raid group WriteCacheRaidGroupType string // Compression holds the type of pool compression Compression string // IsPoolImported used to know whether pool is imported or not IsPoolImported bool // IsPoolReadOnlyMode informs pool ReadOnly mode IsPoolReadOnlyMode bool // IsReplacementInProgress the status of replacement operation IsReplacementInProgress bool // DiskCount represents the total no.of disks present in the pool DiskCount int // TestConfig holds the test related information TestConfig TestConfig }
PoolMocker mocks the zpool utitlity commands
func (*PoolMocker) Add ¶
func (poolMocker *PoolMocker) Add(cmd string) ([]byte, error)
Add mocks the zpool add command and returns error based on the test configuration
func (*PoolMocker) Create ¶
func (poolMocker *PoolMocker) Create(cmd string) ([]byte, error)
Create mocks the zpool create command and will fill the topology according to the command triggered
func (*PoolMocker) Delete ¶
func (poolMocker *PoolMocker) Delete(cmd string) ([]byte, error)
Delete is mock zpool destroy command
func (*PoolMocker) Dump ¶
func (poolMocker *PoolMocker) Dump(cmd string) ([]byte, error)
Dump mocks zpool dump command and return output based on test configuration
func (*PoolMocker) GetProperty ¶
func (poolMocker *PoolMocker) GetProperty(cmd string) ([]byte, error)
GetProperty mocks the zpool get command and returns the error based on the output
func (*PoolMocker) Import ¶
func (poolMocker *PoolMocker) Import(cmd string) ([]byte, error)
Import mocks zpool import command
func (*PoolMocker) LabelClear ¶
func (poolMocker *PoolMocker) LabelClear(cmd string) ([]byte, error)
LabelClear mocks the zpool labelclear command
func (*PoolMocker) Replace ¶
func (poolMocker *PoolMocker) Replace(cmd string) ([]byte, error)
Replace mocks the zpool replace command and retutns error based on the test configuration
func (*PoolMocker) SetProperty ¶
func (poolMocker *PoolMocker) SetProperty(cmd string) ([]byte, error)
SetProperty mocks the zpool get command and returns the error based on the output
type TestConfig ¶
type TestConfig struct { ZpoolCommand ZpoolCommandError // ResilveringProgress represents fake resilvering progress // If the value is 0 then zpool dump marks vdev as resilvering // completed ResilveringProgress int }
TestConfig holds the the test configuration based on this configuration zpool utility commands will return error
type ZpoolCommandError ¶
type ZpoolCommandError struct { ZpoolAddError bool ZpoolClearError bool ZpoolDestroyError bool ZpoolDumpError bool ZpoolGetError bool ZpoolLabelClearError bool ZpoolOnlineError bool ZpoolReplaceError bool ZpoolStatusError bool ZpoolAttachError bool ZpoolCreateError bool ZpoolDetachError bool ZpoolExportError bool ZpoolImportError bool ZpoolOfflineError bool ZpoolRemoveError bool ZpoolSetError bool }
ZpoolCommandError used to inject the errors in various Zpool commands It will help to mock the zpool command behaviour